Select datatype of the field in postgres

后端 未结 7 2058

How do I get datatype of specific field from table in postgres ? For example I have the following table, student_details ( stu_id integer, stu_name varcha

7条回答
  •  不思量自难忘°
    2020-12-12 11:54

    You can get data types from the information_schema (8.4 docs referenced here, but this is not a new feature):

    =# select column_name, data_type from information_schema.columns
    -# where table_name = 'config';
        column_name     | data_type 
    --------------------+-----------
     id                 | integer
     default_printer_id | integer
     master_host_enable | boolean
    (3 rows)
    

提交回复
热议问题