doc-exports/docs/dws/dev/dws_04_0784.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-16 07:24:04 +00:00

13 KiB

PG_TABLES

PG_TABLES displays access to each table in the database.

Table 1 PG_TABLES columns

Name

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 modification time of the table (that is, the last time that a DDL statement is executed on the table).

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)