在PostgreSQL中选择特定数据类型的列
我正在寻找一条信息,但是我正在查看的表有几十列,我记不起列的确切名称。我只知道它是日期类型的。是否有办法只选择在PostgreSQL中选择特定数据类型的列,postgresql,types,Postgresql,Types,我正在寻找一条信息,但是我正在查看的表有几十列,我记不起列的确切名称。我只知道它是日期类型的。是否有办法只选择date列,以便更容易找到列的名称 e、 g 您可以使用信息\u架构。列视图: select column_name from information_schema.columns where table_schema = 'MySchema' and table_name = 'MyTable' and data_type = 'date'; 现在您已经有了类型为date的列的名称,
date
列,以便更容易找到列的名称
e、 g
您可以使用
信息\u架构。列视图:
select column_name
from information_schema.columns
where table_schema = 'MySchema' and table_name = 'MyTable' and data_type = 'date';
现在您已经有了类型为date
的列的名称,您可以使用该信息创建一个仅选择此类列的值的视图。可以有多个名为MyTable
的表。始终为表\u目录
和表\u架构
以及表\u名称
指定值。information\u schema.columns
中没有名为column\u type
的列。
select column_name
from information_schema.columns
where table_schema = 'MySchema' and table_name = 'MyTable' and data_type = 'date';