You should see the entry in pg_class
if you are logged into the same DB of the same DB cluster. Not from another DB in the same cluster. Resolve the OID of your database to its name with:
SELECT datname FROM pg_database WHERE oid = '16460';
(Which works from any DB in the same cluster.)
To make sure you are indeed connected to the right database, run in the same session:
SELECT current_database();
But even if you see the entry in pg_class
, be aware that you can only access temporary objects from within the same session. Each session has its own temporary schema holding their respective temporary objects.
A more insightful version of your query:
SELECT pg_is_other_temp_schema(relnamespace) AS is_other_temp_schema
, relnamespace::regnamespace AS temp_schema
, pg_my_temp_schema()::regnamespace AS my_temp_schema
, pg_size_pretty(pg_total_relation_size(oid)) AS total_relation_size
, *
FROM pg_class
WHERE relpersistence = 't'
ORDER BY relname, pg_is_other_temp_schema(relnamespace), relnamespace::regnamespace::text;
I threw in the total relation size, since you ask for that. More about that:
Sorting "own" temp objects to the top - if there should be multiple ones of the same name.
The added system information functions are explained in the manual.
Related: