Updated on 2024-06-03 GMT+08:00

PG_OBJECT

PG_OBJECT records the creator, creation time, and last modification time of objects of specified types (ordinary tables, indexes, sequences, views, stored procedures, and functions).

Table 1 PG_OBJECT columns

Name

Type

Description

object_oid

oid

Object identifier.

object_type

"char"

Object type.

  • r: ordinary table
  • i: index
  • s: sequence
  • v: view
  • p: stored procedure and function
  • S: package header
  • B: package body

creator

oid

ID of a creator.

ctime

timestamp with time zone

Creation time of an object.

mtime

timestamp with time zone

Last modification time of an object. The modification operations include ALTER, GRANT, and REVOKE.

createcsn

bigint

CSN when an object is created.

changecsn

bigint

CSN when DDL operations are performed on a table or an index.

valid

Boolean

Validity of an object. t indicates valid, and f indicates invalid.

  • Objects created or modified during database initialization (initdb) cannot be recorded. PG_OBJECT does not contain these object records.
  • A database upgraded to this version cannot record objects created before the upgrade. PG_OBJECT does not contain these object records.
  • When the preceding two types of objects are modified again, the modification time (mtime) is recorded. Because the creation time of the objects cannot be obtained, ctime is empty.
  • When an object created before the upgrade is modified again, the modification time (specified by mtime) is recorded. When DDL operations are performed on a table or an index, the transaction commit sequence number (specified by changecsn) of the transaction to which the table or index belongs is recorded. Because the creation time of the object cannot be obtained, ctime and createcsn are empty.
  • The time recorded by ctime and mtime is the start time of the transaction to which the current operation belongs.
  • The time of object modification due to capacity expansion is also recorded.
  • createcsn and changecsn record the transaction commit sequence number of the transaction to which the current operation belongs.
  • If the statement for creating an object has an undefined object, or the referenced object is modified or deleted, the object to be created will be invalid.