Catalog Functions
Several functions are provided to inspect the catalogs and schemas that are configured in the database.
The following catalog functions are available:
| Function | Description |
|---|---|
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.
Query
SELECT current_catalog() = current_database() AS catalog_is_current_db;Result
catalog_is_current_db----------------------- tcurrent_schema()
Returns the name of the currently active schema.
Query
SELECT current_schema();Result
current_schema---------------- publiccurrent_schemas(include_implicit)
Returns the list of schemas in the search path. Pass true to include implicit schemas such as pg_catalog.
Query
SELECT current_schemas(true) AS schemas;Result
schemas--------------------- {pg_catalog,public}Query
SELECT current_schemas(false) AS schemas;Result
schemas---------- {public}