postgresql判断一个表是否存在:
方法一:
<a href="https://www.gaodaima.com/tag/select" title="查看更多关于select的文章" target="_blank">select</a> count(*) from pg_class where relname = '<a href="https://www.gaodaima.com/tag/table" title="查看更多关于table的文章" target="_blank">table</a>name';
www#gaodaima.com来源gao@dai!ma.com搞$代^码网搞代码
方法二:
select count(*) from information_schema.tables where table_schema='public' and table_type='BASE TABLE' and table_name='tablename';
推荐学习《Python教程》。
来源:搞代码网:原文地址:https://www.gaodaima.com