Overview

The current_schema() is a session information function that returns the name of the first existing schema.

Syntax

There are two available syntax versions of current_schema() function:
SELECT current_schema();
It will return NULL if none of the schemas from search_path exist

Example

The following example shows how to get the current schema name using this function
SELECT current_schema();
The output from the above query can be as follows:
+------------+
| f          |
+------------+
| public     |
+------------+