2017-08-03 90 views

回答

1

你可以使用pg_class

relkind炭

R =普通表,I =索引,S =序列,V =视图中,m =物化视图中,c =复合类型,T = TOAST表,F =外部表

IF EXISTS (SELECT relname 
      FROM pg_class 
      WHERE relname='<object_name>' 
      AND relkind = 'v') 
THEN 
... 
1

你可以找到从information_schema.tables认为信息:

select table_type 
from information_schema.tables 
where table_schema = 'my_schema' and table_name = 'my_table'` 

table_type列描述:

类型表中的:基表用于持久基表(正常表型),VIEW为一个视图,外部表为外国表,或LOCAL TEMPORARY临时表