Skip to main content

Catalog Functions

Several functions are provided to inspect the catalogs and schemas that are configured in the database.

The following catalog functions are available:

FunctionDescription
current_catalog()Returns the name of the currently active catalog.
current_schema()Returns the name of the currently active schema.
current_schemas(include_implicit)Returns the list of schemas in the search path. Pass true to include implicit schemas.

current_catalog()​

Returns the name of the currently active catalog, which is the database the session is connected to.

SQL
SELECT current_catalog() = current_database() AS catalog_is_current_db;
 catalog_is_current_db
-----------------------
 t

current_schema()​

Returns the name of the currently active schema.

SQL
SELECT current_schema();
 current_schema
----------------
 public

current_schemas(include_implicit)​

Returns the list of schemas in the search path. Pass true to include implicit schemas such as pg_catalog.

SQL
SELECT current_schemas(true) AS schemas;
 schemas
---------------------
 {pg_catalog,public}
SQL
SELECT current_schemas(false) AS schemas;
 schemas
----------
 {public}