PostgreSQL current_schema() Function

The PostgreSQL current_schema() function returns the name of the current schema.

current_schema() Syntax

Here is the syntax of the PostgreSQL current_schema() function:

current_schema() -> name

or

current_schema -> name

Parameters

The PostgreSQL current_schema() function does not require any parameters.

Return value

The PostgreSQL current_schema() function returns the name of the current schema.

current_schema() Examples

To get the name of the current database, use the following SELECT statement with the current_schema() function:

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

Or you can use current_schema instead current_schema(), as follows:

SELECT current_schema;
 current_schema 
----------------
 public