Cloud

pg_class

The pg_class stores information about tables, indexes, views, and other relations in the database. It contains one row for each relation. This includes each table in a Redpanda catalog or Iceberg catalog, and each nested composite type in those tables. It mimics the pg_class PostgreSQL system catalog.

Columns

The following columns are available for querying in pg_class:

Column Type Description

oid

int

This column represents the object ID (OID) of the relation that Redpanda SQL generates.

relname

text

This column represents the name of the relation. For a table in an Iceberg catalog, the name includes the Iceberg namespace, such as redpanda.orders. The name does not include the catalog name. A nested composite type uses its field path as its name, such as redpanda.headers, so several rows can have the same name. To identify a relation, use oid.

relnamespace

int

This column represents the OID of the schema that holds the relation

relhasindex

bool

Returns true if the table has any indexes

relkind

text

This column represents the type of relation: r for tables, i for indexes, v for views, f for tables in Redpanda catalogs and Iceberg catalogs, and c for nested composite types in those tables

reltype

int

Unused

reloftype

int

Unused

relowner

int

This column represents the OID of the role that owns the relation. References pg_authid.oid

relam

int

Unused

relfilenode

int

Unused

reltablespace

int

Unused

relpages

int

Unused

reltuples

float

Unused

relallvisible

int

Unused

reltoastrelid

int

Unused

relisshared

bool

Unused

relpersistence

text

Unused

relnatts

int

Unused

relchecks

int

Unused

relhasrules

bool

Unused

relhastriggers

bool

Unused

relhassubclass

bool

Unused

relrowsecurity

bool

Unused

relforcerowsecurity

bool

Unused

relispopulated

bool

Unused

relreplident

text

Unused

relispartition

bool

Unused

relrewrite

int

Unused

relfrozenxid

int

Unused

relacl

text

Unused

reloptions

text

Unused

relminmxid

text

Unused

relpartbound

text

Unused

Examples

List the views and the tables in Redpanda catalogs and Iceberg catalogs that you can see:

SELECT oid, relname, relkind
FROM pg_class
WHERE relkind IN ('v', 'f')
ORDER BY relkind, relname;

The query returns one row for each view (relkind v) and one row for each table in a catalog (relkind f). To find the catalog that a table belongs to, join to pg_foreign_table.