pg_my_temp_schema()

A function returning the OID of the session's temporary schema

pg_my_temp_schema() is a system function returning the OID of the session's temporary schema, if one exists.

pg_my_temp_schema() was added in PostgreSQL 8.2.

Usage

pg_my_temp_schema () → oid

If no temporary schema exists in the session, 0 is returned.

Change history

Examples

Basic usage example for pg_my_temp_schema():

postgres=# SELECT pg_my_temp_schema(); -- no temporary schema exist yet in this session
 pg_my_temp_schema 
-------------------
                 0
(1 row)

postgres=# CREATE TEMPORARY TABLE foo (id INT);
CREATE TABLE

postgres=# SELECT pg_my_temp_schema();
 pg_my_temp_schema 
-------------------
             24608
(1 row)

Categories

Schema (namespace), System function

See also

pg_is_other_temp_schema()