-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: Add support for TEMP tables #5807
Description
Passing the modifier TEMP or TEMPORARY to CREATE TABLE would indicate the the table should be dropped when the session ends.
Like other DBs, using the unqualified table name for the remainder of the session would reference the temporary table -- an existing, non-temporary table of the same name would need to be accessed using a qualified name.
Postgres docs, for reference:
TEMPORARY or TEMP
If specified, the table is created as a temporary table. Temporary tables are automatically dropped at the end of a session, or optionally at the end of the current transaction (see ON COMMIT below). Existing permanent tables with the same name are not visible to the current session while the temporary table exists, unless they are referenced with schema-qualified names. Any indexes created on a temporary table are automatically temporary as well....
Optionally, GLOBAL or LOCAL can be written before TEMPORARY or TEMP. This presently makes no difference in PostgreSQL and is deprecated; see Compatibility.
http://www.postgresql.org/docs/current/static/sql-createtable.html