Available in versions: Dev (3.21) | Latest (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15

CURRENT_CATALOG

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The CURRENT_CATALOG() function produces the dialect dependent expression to produce the current default catalog for the JDBC connection.

SELECT current_catalog;
create.select(currentCatalog()).fetch();

The result being, for example

+-----------------+
| current_catalog |
+-----------------+
| my_database     |
+-----------------+
In some dialects, the schema and the catalog is the same thing, in case of which this function produces the same value as CURRENT_SCHEMA

Dialect support

This example using jOOQ:

currentCatalog()

Translates to the following dialect specific expressions:

Aurora MySQL, MariaDB, MemSQL, MySQL

database()

Aurora Postgres, CockroachDB, Databricks, Postgres, Snowflake, YugabyteDB

current_database()

ClickHouse

currentDatabase()

Firebird, SQLite

''

Informix

dbinfo('dbname')

SQLDataWarehouse, SQLServer

db_name()

ASE, Access, BigQuery, DB2, Derby, DuckDB, Exasol, H2, HSQLDB, Hana, Oracle, Redshift, Sybase, Teradata, Trino, Vertica

/* UNSUPPORTED */
Generated with jOOQ 3.21. Support in older jOOQ versions may differ. Translate your own SQL on our website

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo