PG_TABLES
PG_TABLES displays access to each table in the database.
Column | Type | Reference | Description |
|---|---|---|---|
schemaname | Name | PG_NAMESPACE.nspname | Name of the schema that contains the table |
tablename | Name | PG_CLASS.relname | Name of the table |
tableowner | Name | pg_get_userbyid(PG_CLASS.relowner) | Owner of the table |
tablespace | Name | PG_TABLESPACE.spcname | Tablespace that contains the table. The default value is null |
hasindexes | boolean | PG_CLASS.relhasindex | Whether the table has (or recently had) an index. If it does, its value is true. Otherwise, its value is false. |
hasrules | boolean | PG_CLASS.relhasrules | Whether the table has rules. If it does, its value is true. Otherwise, its value is false. |
hastriggers | boolean | PG_CLASS.RELHASTRIGGERS | Whether the table has triggers. If it does, its value is true. Otherwise, its value is false. |
tablecreator | Name | pg_get_userbyid(PG_OBJECT.creator) | Table creator. If the creator has been deleted, no value is returned. |
created | Timestamp with time zone | PG_OBJECT.ctime | Time when the table was created. |
last_ddl_time | Timestamp with time zone | PG_OBJECT.mtime | Last time when the cluster was modified. |
Example
Query all tables in a specified schema.
1 2 3 4 5 6 7 8 9 10 11 12 13 | SELECT tablename FROM PG_TABLES WHERE schemaname = 'myschema'; tablename ---------------- inventory product sales_info test1 mytable product_info customer_info newproducts customer_t1 (9 rows) |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

