I am using pgAdmin for my Postgres 8.4 database and I was wondering where (any table/schema/etc. ?) may I find a list of currently used temporary tables? I assume there has to be a place where I can find it.
They are not present in a catalog object tables nor in views, any other suggestions?
Postgres creates a temporary schema for temporary tables named "pg_temp_#", you can see it with psql... create temp table mytemptable(name varchar); select c. relname from pg_namespace n join pg_class c on n. oid=c.
A temporary table, as the name implies, is a short-lived table that exists for the duration of a database session. PostgreSQL automatically drops the temporary tables at the end of a session or a transaction.
These tables reside inside tempdb , which is also a database system. ); Temporary tables are only visible within the session in which it was created; no other sessions will be able to view it.
The name of a temporary table must start with a hash (#). Now, to see where this table exists; go to “Object Explorer -> Databases -> System Databases-> tempdb -> Temporary Tables”. You will see your temporary table name along with the identifier.
Postgres creates a temporary schema for temporary tables named "pg_temp_#", you can see it with psql...
create temp table mytemptable(name varchar);
select c.relname
from pg_namespace n
join pg_class c on n.oid=c.relnamespace
where n.nspname='pg_temp_1';
You can list your schemas executing "\dn" in psql.
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With