summaryrefslogtreecommitdiff
path: root/sql/temporary_tables.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/temporary_tables.cc')
-rw-r--r--sql/temporary_tables.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index c05fc632a94..0aa5396f35b 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -73,7 +73,9 @@ TABLE *THD::create_and_open_tmp_table(handlerton *hton,
if ((share= create_temporary_table(hton, frm, path, db, table_name)))
{
+ open_options|= HA_OPEN_FOR_CREATE;
table= open_temporary_table(share, table_name, open_in_engine);
+ open_options&= ~HA_OPEN_FOR_CREATE;
/*
Failed to open a temporary table instance. As we are not passing
@@ -1117,8 +1119,10 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
if (open_table_from_share(this, share, alias,
open_in_engine ? (uint)HA_OPEN_KEYFILE : 0,
- EXTRA_RECORD, ha_open_options, table,
- open_in_engine ? false : true))
+ EXTRA_RECORD,
+ (ha_open_options |
+ (open_options & HA_OPEN_FOR_CREATE)),
+ table, open_in_engine ? false : true))
{
my_free(table);
DBUG_RETURN(NULL);
@@ -1126,7 +1130,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share,
table->reginfo.lock_type= TL_WRITE; /* Simulate locked */
table->grant.privilege= TMP_TABLE_ACLS;
- share->tmp_table= (table->file->has_transactions() ?
+ share->tmp_table= (table->file->has_transaction_manager() ?
TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE);
table->pos_in_table_list= 0;