PostgreSQL pg_my_temp_schema() Function

The PostgreSQL pg_my_temp_schema() function returns the OID of the temporary schema for the current session.

pg_my_temp_schema() Syntax

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

pg_my_temp_schema() -> oid

Parameters

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

Return value

The PostgreSQL pg_my_temp_schema() function returns the OID of the temporary schema for the current session. If the current session does not have any temporary schema, the pg_my_temp_schema() function returns 0.

pg_my_temp_schema() Examples

To get the OID of the temporary schema for the current session, use the following statement with the pg_my_temp_schema() function:

SELECT pg_my_temp_schema();
 pg_my_temp_schema
-------------------
                 0

The pg_my_temp_schema() function returns 0, because there is not a temporary schema for the current session.

You can create a temporary table with the following statement:

CREATE TEMPORARY TABLE test (id INT);

Then, you look at the temporary schema for the current session:

SELECT pg_my_temp_schema();
 pg_my_temp_schema
-------------------
             17380