PostgreSql查询表名和字段名是否存在

PostgreSql

表:
select count (*) from information_schema.tables WHERE table_schema = 'table_schema' and table_name = 'table_name';
select * from information_schema.tables WHERE table_schema = 'table_schema' and table_name = 'table_name';
字段:
select count(*) from information_schema.columns WHERE table_schema = 'table_schema' and table_name = 'table_name' and column_name = 'column_name';
select * from information_schema.columns WHERE table_schema = 'table_schema' and table_name = 'table_name' and column_name = 'column_name';


猜你喜欢

转载自blog.csdn.net/gaoqi717/article/details/79255000
今日推荐