Details
-
New Feature
-
Status: Stalled (View Workflow)
-
Critical
-
Resolution: Unresolved
-
None
-
Q4/2025 Server 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
-
- causes
-
MDEV-37368 Assertion failed in close_thread_tables on UPDATE referring bad field
-
- Closed
-
-
MDEV-37369 SIGSEGV on NEXTVAL from Global temporary table
-
- Closed
-
-
MDEV-37378 SIGSEGV in MDL_ticket::has_stronger_or_equal_type and Assertion `!table->s->tmp_table' failed in wait_while_table_is_used on CREATE TRIGGER
-
- Closed
-
-
MDEV-37379 Assertion `index->is_readable()' failed in dict_create_index_tree_in_mem on REPLACE DELAYED
-
- Closed
-
-
MDEV-37380 SIGSEGV in thr_upgrade_write_delay_lock and ASAN use-after-poison in Delayed_insert::handle_inserts on INSERT DELAYED
-
- Closed
-
-
MDEV-37381 SIGSEGV in mysql_ha_close_table after HANDLER OPEN of Global temporary table
-
- Closed
-
-
MDEV-37382 SIGSEGV and UBSAN null-pointer-use in wait_while_table_is_used on CoR GTT
-
- Closed
-
-
MDEV-37383 Crash in end_read_record after REPAIR of Global temporary table
-
- Closed
-
-
MDEV-37384 SIGSEGV in mysql_unpack_partition on CREATE GTT ... LIKE partitioned table
-
- Closed
-
-
MDEV-37385 Thread hang on CoR where the original table is a GTT
-
- Closed
-
-
MDEV-37386 SIGSEGV in close_thread_table, UBSAN null-pointer-use in close_thread_table and Assertion `thd->open_tables == table->table' failed in mysql_create_like_table on CREATE GTT ... LIKE
-
- Open
-
-
MDEV-37394 SIGSEGV in handler::ha_external_lock on CREATE GTT ... ENGINE=INNODB SELECT, ASAN heap-use-after-free in unlock_external
-
- Closed
-
-
MDEV-37395 SIGSEGV on CREATE TABLE ... SELECT where source table is a GTT
-
- Closed
-
-
MDEV-37576 Assertion `!global_table.versioned()' failed after ALTER TABLE GTT ADD SYSTEM VERSIONING
-
- Closed
-
-
MDEV-37577 Assertion `has_temporary_tables() || (rgi_slave && rgi_slave->is_parallel_exec)' failed in THD::open_temporary_table on CREATE TABLE
-
- Closed
-
-
MDEV-37578 Assertion failed in TDC_element::flush on ALTER TABLE GTT DISCARD TABLESPACE
-
- Closed
-
-
MDEV-37579 use-after-free in MDL_context::release_lock on FLUSH TABLE GTT
-
- Closed
-
-
MDEV-37594 Thread hang on TRUNCATE GTT after server_id change
-
- Closed
-
-
MDEV-37595 Assertion `thd->transaction->stmt.is_empty()' failed in mysql_ha_open when using mrg_myisam GTT
-
- Closed
-
-
MDEV-37596 enforce_storage_engine has an effect on child global temporary tables
-
- Closed
-
-
MDEV-37597 InnoDB: Failing assertion: table->get_ref_count() == 0 in dict_sys_t::remove on UPDATE
-
- Closed
-
-
MDEV-37612 SIGSEGV in mysql_ha_close_table (opt) and in MDL_ticket::has_pending_conflicting_lock (dbg) after HANDLER OPEN
-
- Closed
-
-
MDEV-37656 Thread hang in 'starting' state on FLUSH TABLES and shutdown hang, where the original table is a LOCKED GTT
-
- Closed
-
-
MDEV-37657 SIGSEGV in mysql_ha_flush on SHOW CREATE TABLE after HANDLER OPEN GTT
-
- Closed
-
-
MDEV-37660 Make Global Temporary Tables DDL errors more specific
-
- Needs Feedback
-
-
MDEV-37666 Global temporary table can be created with system versioning using CREATE LIKE
-
- Closed
-
-
MDEV-37667 SIGSEGV in MDL_context::release_lock on ALTER on locked GTT in low memory env
-
- Closed
-
-
MDEV-37668 SIGSEGV on DROP TABLE GTT under LOCK TABLES and different server_id
-
- Needs Feedback
-
-
MDEV-37681 SIGSEGV on TRUNCATE GTT after failed RENAME under LOCK TABLE
-
- Closed
-
-
MDEV-37690 SIGSEGV and UBSAN null-pointer-use in myrocks::Rdb_transaction_impl::prepare on CREATE TABLE ... AS SELECT
-
- Closed
-
-
MDEV-37693 use-after-free in mysql_ha_flush after 2nd HANDLER OPEN execution
-
- Closed
-
-
MDEV-37694 ASAN heap-use-after-free in check_column_name on CoR ... LIKE
-
- Closed
-
-
MDEV-37700 DROP TABLE on GTT table succeeds in MariaDB only
-
- Closed
-
-
MDEV-37718 Assertion '!thd->rgi_slave' failed in open_global_temporary_table on CREATE/ANALYZE GTT
-
- Closed
-
-
MDEV-37720 use-after-free on CREATE OR REPLACE GTT under LOCK TABLES and pseudo_slave_mode
-
- Confirmed
-
-
MDEV-37742 SIGSEGV in Gtid_index_writer::write_current_node on SET GLOBAL binlog_checksum (opt builds)
-
- Closed
-
-
MDEV-37793 Behavior of DROP TABLE / DROP DATABASE is inconsistent with GTT
-
- Open
-
-
MDEV-37798 Incomplete SAVEPOINT support for InnoDB global temporary tables
-
- Closed
-
-
MDEV-37799 Incorrect behavior for DELETE statements on a GTT table
-
- Closed
-
-
MDEV-37817 DROP TABLE GTT doesn't succeed for ON COMMIT DELETE ROWS
-
- Closed
-
-
MDEV-37850 Wrong error on DROP TABLE GTT after DROP DATABASE
-
- Closed
-
-
MDEV-37871 SIGSEGV I_P_List_iterator, UBSAN reference binding to null pointer on DROP DATABASE test
-
- Closed
-
-
MDEV-37872 SIGSEGV in MDL_context::release_loc, Assertion `mdl_ticket->m_duration == MDL_TRANSACTION && duration != MDL_TRANSACTION' failed, ASAN heap-use-after-free in I_P_List on CoR
-
- Confirmed
-
-
MDEV-37873 Assertion `!memcmp(trx_id->data, reset_trx_id, 6)' failed in btr_cur_optimistic_insert on CREATE GTT
-
- Confirmed
-
-
MDEV-37896 MTR Tests main.global_temporary_table and rpl.global_temporary_table are not stable on 2nd run
-
- Open
-
-
MDEV-37897 Previously fixed MDEV-37690 bug was re-introduced into GTT feature branch
-
- In Testing
-
-
MDEV-37898 No GTT MTR coverage on optimized builds due to debug_sync requirement
-
- Confirmed
-
-
MDEV-37909 GTT: "errno: 0 "Internal error/check" on CoR ... LIKE under lock
-
- Open
-
-
MDEV-37928 Assertion !thd->rgi_slave failed on ANALYZE TABLE on replica
-
- Confirmed
-
-
MDEV-37929 Assertion !thd->rgi_slave' failed on REPAIR TABLE on replica
-
- Confirmed
-
-
MDEV-37934 Assertion `thd->transaction->stmt.is_empty() || (thd->state_flags & Open_tables_state::BACKUPS_AVAIL)' failed in bool open_normal_and_derived_tables(THD*, TABLE_LIST*, uint, uint)
-
- Confirmed
-
-
MDEV-37940 Assertion `!thd->rgi_slave' failed on START SLAVE
-
- Confirmed
-
-
MDEV-37941 Assertion `!thd->rgi_slave' failed on INSERT w/ parallel slave
-
- Confirmed
-
-
MDEV-37956 ASAN heap-use-after-free and SIGSEGV in mysql_ha_close_table on DROP DATABASE
-
- Open
-
-
MDEV-37957 Assertion `(*tables)->reginfo.lock_type >= TL_READ_SKIP_LOCKED' failed on HANDLER READ
-
- Open
-
-
MDEV-37958 SIGSEGV and UBSAN invalid-enum-load in ha_mroonga::storage_create_foreign_key on INSERT
-
- Open
-
-
MDEV-37963 wait_while_table_is_used() variation on MDEV-26805 stack in GTT branch
-
- Open
-
-
MDEV-37968 Assertion `table->s->table_category == TABLE_CATEGORY_SYSTEM || table->s->table_category == TABLE_CATEGORY_STATISTICS' failed in bool open_system_tables_for_read(THD *, TABLE_LIST *)
-
- Open
-
- is blocked by
-
MDEV-37348 Logged CREATE TEMPORARY TABLE LIKE from unlogged table fails
-
- Closed
-
-
MDEV-37877 Assertion `!mysql_bin_log.is_open()' failed in THD::mark_tmp_table_as_free_for_reuse on UPDATE
-
- Stalled
-
- is part of
-
MDEV-32521 SQL Server compatibility
-
- Open
-
-
MDEV-35388 PostgreSQL-compatible syntax
-
- Open
-
-
MDEV-35973 Oracle Compatibility Project 1 for 2025
-
- Stalled
-
- relates to
-
MDEV-37877 Assertion `!mysql_bin_log.is_open()' failed in THD::mark_tmp_table_as_free_for_reuse on UPDATE
-
- Stalled
-
-
MDEV-10872 Providing compatibility Oracle database
-
- Open
-
-
MDEV-37686 rpl.create_or_replace_mix2 fails in MDEV-35915 branch
-
- Closed
-
-
MDEV-37719 use-after-free on logged CREATE OR REPLACE TEMPORARY TABLE LIKE not-logged-table
-
- In Review
-
-
MDEV-37720 use-after-free on CREATE OR REPLACE GTT under LOCK TABLES and pseudo_slave_mode
-
- Confirmed
-
- links to