PostgreSQL pg_is_other_temp_schema() Function
The PostgreSQL pg_is_other_temp_schema()
function checks whether the specified OID is the OID of another session’s temporary schema.
pg_is_other_temp_schema()
Syntax
Here is the syntax of the PostgreSQL pg_is_other_temp_schema()
function:
pg_is_other_temp_schema(oid) -> oid
Parameters
oid
-
Required. The OID to check.
Return value
The PostgreSQL pg_is_other_temp_schema()
function checks whether the specified OID is the OID of another session’s temporary schema, and returns TRUE
or FALSE
.
pg_is_other_temp_schema()
Examples
First, let’s create a temporary table with the following statement:
CREATE TEMPORARY TABLE test (id INT);
Then, look at the OID of the temporary schema for the current session :
SELECT pg_my_temp_schema();
pg_my_temp_schema
-------------------
17380
In the current session, we use to pg_is_other_temp_schema()
check if the OID 17380
is the OID of the ephemeral schema of another session:
SELECT pg_is_other_temp_schema(17380);
pg_is_other_temp_schema
-------------------------
f
Here, the pg_is_other_temp_schema()
function returns f
(FALSE
). Because 17380
is the OID of the temporary schema of the current session, not the OID of the temporary schema (Schema) of other sessions.
Let’s open a new session, executing the pg_is_other_temp_schema()
function:
SELECT pg_is_other_temp_schema(17380);
pg_is_other_temp_schema
-------------------------
t