postgresql判断一个表有没有存在数据库的方法

这篇文章主要介绍postgresql判断一个表有没有存在数据库的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

postgresql判断一个表是否存在:

方法一:

select count(*) from pg_class where relname = 'tablename';

方法二:

select count(*) from information_schema.tables where table_schema='public' and table_type='BASE TABLE' and table_name='tablename';

以上是postgresql判断一个表有没有存在数据库的方法的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注行业资讯频道!