Home > Blockchain >  How to translate USER_OBJECTS.TEMPORARY in PostgreSQL?
How to translate USER_OBJECTS.TEMPORARY in PostgreSQL?

Time:10-22

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

CodePudding user response:

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

CodePudding user response:

That can be found in relpersistence: t = temporary table

SELECT relpersistence, * FROM pg_class;
  • Related