有3种方法进行转换
1.通过格式化函数进行转换
- to_char
- to_date
- to_number
- to_timestamp
2通过CAST函数进行转换()
3通过::操作符转换
postgres=# select oid,relname from pg_class where relname='test_json1'; oid | relname -------+------------ 16462 | test_json1 (1 row) postgres=# select attname from pg_attribute where attrelid='test_json1' and attnum>0; ERROR: invalid input syntax for type oid: "test_json1" LINE 1: select attname from pg_attribute where attrelid='test_json1'... ^ postgres=# select attname from pg_attribute where attrelid='test_json1'::regclass and attnum>0; attname --------- id name (2 rows)