postgresql – 选择postgres中的字段的数据类型
发布时间:2020-12-13 16:51:57 所属栏目:百科 来源:网络整理
导读:如何从postgres表中获取特定字段的数据类型? 例如 我有下面的表, student_details( stu_id整数, stu_name varchar(30), joined_date时间戳 ); 在这使用字段名称/或任何其他方式,我需要获得特定字段的数据类型。有什么可能吗? 您可以从 information_sch
如何从postgres表中获取特定字段的数据类型?
例如 我有下面的表, student_details( stu_id整数, stu_name varchar(30), joined_date时间戳 ); 在这使用字段名称/或任何其他方式,我需要获得特定字段的数据类型。有什么可能吗?
您可以从
information_schema(这里参考的8.4文档,但这不是一个新的功能)获取数据类型:
=# 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) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |