Updated on 2024-05-07 GMT+08:00

PG_TABLES

PG_TABLES is used to query useful information about each table in the database.

Table 1 PG_TABLES columns

Name

Type

Reference

Description

schemaname

name

nspname in PG_NAMESPACE

Name of the schema that contains a table.

tablename

name

relname in PG_CLASS

Table name.

tableowner

name

pg_get_userbyid(relowner in PG_CLASS)

Table owner.

tablespace

name

spcname in PG_TABLESPACE

Tablespace that contains the table (default value: NULL).

hasindexes

boolean

relhasindex in PG_CLASS

Specifies whether the table has (or recently had) an index. If it does, the value is TRUE. Otherwise, the value is FALSE.

hasrules

boolean

relhasruls in PG_CLASS

Specifies whether the table has rules. If it does, the value is TRUE. Otherwise, the value is FALSE.

hastriggers

boolean

RELHASTRIGGERS in PG_CLASS

Specifies whether the table has triggers. If it does, the value is TRUE. Otherwise, the value is FALSE.

tablecreator

name

pg_get_userbyid(creator in PG_OBJECT)

Table creator.

created

timestamp with time zone

ctime in PG_OBJECT

Time when the table is created.

last_ddl_time

timestamp with time zone

mtime in PG_OBJECT

Time when the last DDL operation is performed on the table.