Great article, but I think there are some tweaks can be made to make it more accurate :
- A temporary table gets automatically dropped on closing the session.
That behaviour is controlled by ON COMMIT and can be changed to drop table at the end of transaction rather than at the end of session.
2. A temporary table does not belong to any schema.
Postgres automatically creates pg_temp_nnn schemas which can be aliased by the session that creates temp table as pg_temp. The actual schema name can be found with
select pg_namespace.nspname from pg_catalog.pg_namespace where pg_namespace.oid=pg_my_temp_schema()
3. When a temporary table shares the same name as that of a permanent table, the permanent table cannot be accessed until the temporary table gets dropped from the database or session.
Permanent table (tables) can always be accessed by full name [schema_name].[table_name] regardless of whether temp table exist.