Cloud

pg_namespace

The pg_namespace contains information about schema definitions. It mimics the pg_namespace PostgreSQL system catalog.

To learn more about Schema and how it is managed in Redpanda SQL, see the schema documentation.

Columns

The pg_namespace catalog has the following key columns:

Column Type Description

oid

int

This column represents the Object ID, a unique identifier assigned to each namespace

nspname

text

This column represents the name of the namespace

nspowner

int

This column represents the owner of the namespace

nspacl

text

unused

Examples

Create a schema

In this example, the “sales” and “hr” schemas are created using the following query:

CREATE SCHEMA sales;
CREATE SCHEMA hr;

The successful result would look like this:

COMPLETE
COMPLETE

View schema definitions

Use a SELECT statement on the pg_namespace catalog to show the schema definitions.

SELECT nspname AS schema_name, oid AS schema_oid
FROM pg_namespace;

The result shows the list of schemas and their IDs:

 schema_name | schema_oid
-------------+------------
 public      |          0
 sales       |          3
 hr          |          4