Determining whether there is a table PostgreSQL

postgresql determines whether a table exists:

method one:

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

 

Method Two:

COUNT SELECT (*) = TABLE_SCHEMA from information_schema.tables WHERE 'public' and TABLE_TYPE = 'TABLE BASE' and table_name = 'TableName';
---------------------
author: wolf maple
source: CSDN
original: https: //blog.csdn.net/leixiaorong/article/details/7735883
copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin www.cnblogs.com/telwanggs/p/11201000.html