Skip to content

sql: Add support for TEMP tables #5807

@dt

Description

@dt

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

Metadata

Metadata

Assignees

Labels

A-sql-pgcompatSemantic compatibility with PostgreSQLA-sql-semanticsA-tools-hibernateIssues that pertain to Hibernate integration.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)X-anchored-telemetryThe issue number is anchored by telemetry references.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions