Details
-
New Feature
-
Status: Needs Feedback (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
Q2/2025 Development
Description
GLOBAL TEMPORARY TABLE is a feature found in Oracle, MSSQL, PostgreSQL etc.
Syntax in Oracle:
CREATE GLOBAL TEMPORARY TABLE tmp_table |
{ (create_definition, ...)
|
| [SELECT * FROM tbl_NAME WHERE conditions ] } |
ON COMMIT [DELETE | PRESERVE] ROWS |
The purpose of this syntax is to create temporary table where each user can have
their own data, which is destroyed at the end of the session.
Any user with access right to this table can access and use it.
One suggested way to implement this in MariaDB is to have "CREATE GLOBAL TEMPORARY t1" create a 'template' for future temporary tables with name t1.
Internally in MariaDB we would only create a .frm file for the table.
On first access to the table, MariaDB would internally execute
"CREATE TEMPORARY TABLE t1 LIKE t1" on the engine used when "CREATE GLOBAL ..." was created. Any future usage of t1 would use the temporary table t1.
"DROP TABLE t1" would drop the internal temporary table.
To drop the global one, one would have to use "DROP GLOBAL TEMPORARY TABLE".
Before starting implementing this, please check with SQL Standard, Oracle, MSSQL and PostgreSQL that the above implementation would work as GLOBAL TEMPORARY tables are expected to work
Attachments
Issue Links
- blocks
-
MCOL-5642 support querying temporary tables with cross engine joins
-
- Open
-
- is part of
-
MDEV-32521 SQL Server compatibility
-
- Open
-
-
MDEV-35388 Postgres compatible syntax
-
- Open
-
-
MDEV-35973 Oracle Compatibility Project 1 for 2025
-
- In Progress
-
- relates to
-
MDEV-10872 Providing compatibility Oracle database
-
- Open
-
- links to
Code can be found at 12.0-nikita-global-tmp