skip to Main Content

I have this code in Oracle:

SELECT *
FROM USER_OBJECTS
WHERE  TEMPORARY = 'N'

I know that the USER_OBJECT table in Postgres is pg_catalog.pg_class, but what’s the equivalent of the TEMPORARY column?
Thanks

2

Answers


  1. That can be found in relpersistence: t = temporary table

    SELECT relpersistence, * FROM pg_class;
    
    Login or Signup to reply.
  2. SELECT *
    FROM pg_class 
    WHERE relpersistence = 't';
    

    REF: https://www.postgresql.org/docs/current/catalog-pg-class.html

    relpersistence char
    p = permanent table/sequence, u = unlogged table/sequence, t = temporary table/sequence

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search