Updated on 2023-10-23 GMT+08:00

PG_TABLES

PG_TABLES provides 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 a table

tablename

name

PG_CLASS.relname

Table name

tableowner

name

pg_get_userbyid(PG_CLASS.relowner)

Table owner

tablespace

name

PG_TABLESPACE.spcname

Tablespace that contains the table (default value: null)

hasindexes

boolean

PG_CLASS.relhasindex

Whether the table has (or recently had) an index. If it does, the value is true. Otherwise, the value is false.

hasrules

boolean

PG_CLASS.relhasruls

Whether the table has rules. If it does, the value is true. Otherwise, the value is false.

hastriggers

boolean

PG_CLASS.RELHASTRIGGERS

The value is true if the table has triggers; otherwise, the value is false.

tablecreator

name

pg_get_userbyid(PG_OBJECT.creator)

Table creator.

created

timestamp with time zone

PG_OBJECT.ctime

Time when the table is created.

last_ddl_time

timestamp with time zone

PG_OBJECT.mtime

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