-- open为schema t_test为表名
-- 判断表是否存在 存在返回 1 不存在返回 0
SELECT
COUNT(1) as cnt
FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace)
WHERE n.nspname = 'open'
AND c.relname = 't_test';
-- 检查某个表是否存在
SELECT
TABLE_NAME
FROM information_schema.TABLES
WHERE table_schema='open'
AND TABLE_NAME='t_test';