Select datatype of the field in postgres

后端 未结 7 2069

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 use the pg_typeof() function, which also works well for arbitrary values.

    SELECT pg_typeof("stu_id"), pg_typeof(100) from student_details limit 1;
    

提交回复
热议问题