且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PostgreSQL检查表是否存在并抛出“关系不存在”。错误

更新时间:2023-09-03 15:01:58

尽管根据权限的设置方式,您可能都无法访问表,但这两种方法都应该有效:

Either of these should work, though depending on how your permissions are set up you may not have access to the tables:

选择存在(从pg_class中选择relname,其中relname ='table_name');

选择存在(从information_schema.tables中选择table_name ='table_name');