有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)