Postgresql获取不同的架构表列

时间:2016-10-14 14:47:17

标签: postgresql

我有一个查询。我使用了一些模式。我想获得不同的架构表列名称。

select column_name 
from information_schema.columns 
where table_name='public.combine' 
   or table_name='kds.2014_new' 
   or table_name='public.point' 
   or table_name='spt.point'

当我运行此查询时,我得到0结果。我怎么解决这个问题?

1 个答案:

答案 0 :(得分:1)

您必须将table_nametable_schema

分开
SELECT column_name
  FROM information_schema.columns
 WHERE (table_name = 'combine' AND table_schema = 'public')
    OR (table_name = '2016_new' AND table_schema = 'kds')
    OR (table_name = 'point' AND table_schema = 'public')
    OR (table_name = 'point' AND table_schema = 'spt')