Skip to content
/ server Public

Commit 4dbbd31

Browse files
committed
MDEV-23298 Assertion `table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE' failed in check_lock_and_start_stmt on CREATE OR REPLACE TABLE
Fixed by removing wrong assert Review: Sanja Byelkin
1 parent b64db51 commit 4dbbd31

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

mysql-test/main/create_or_replace.result

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,32 @@ DROP TABLE IF EXISTS tm, t;
582582
#
583583
# End of 10.4 tests
584584
SET GLOBAL innodb_stats_persistent=@save_persistent;
585+
#
586+
# MDEV-23298 Assertion `table_list->prelocking_placeholder ==
587+
# TABLE_LIST::PRELOCK_NONE' failed in check_lock_and_start_stmt on
588+
# CREATE OR REPLACE TABLE
589+
#
590+
create table t2 (a int);
591+
insert into t2 values(1),(2);
592+
CREATE TABLE t1 (a INT);
593+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q;
594+
drop table t1;
595+
CREATE TABLE t1 (a INT);
596+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q, t2.a from t2;
597+
SELECT * from t1;
598+
q a
599+
SELECT 1 1
600+
SELECT 1 2
601+
drop table t1;
602+
CREATE TABLE t1 (a INT);
603+
lock table t1 write,t2 read, sys.sys_config read;
604+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q, t2.a from t2;
605+
unlock tables;
606+
select * from t1;
607+
q a
608+
SELECT 1 1
609+
SELECT 1 2
610+
drop table t1,t2;
611+
#
612+
# End of 10.6 tests
613+
#

mysql-test/main/create_or_replace.test

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,3 +532,29 @@ DROP TABLE IF EXISTS tm, t;
532532
--echo # End of 10.4 tests
533533

534534
SET GLOBAL innodb_stats_persistent=@save_persistent;
535+
536+
--echo #
537+
--echo # MDEV-23298 Assertion `table_list->prelocking_placeholder ==
538+
--echo # TABLE_LIST::PRELOCK_NONE' failed in check_lock_and_start_stmt on
539+
--echo # CREATE OR REPLACE TABLE
540+
--echo #
541+
542+
create table t2 (a int);
543+
insert into t2 values(1),(2);
544+
CREATE TABLE t1 (a INT);
545+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q;
546+
drop table t1;
547+
CREATE TABLE t1 (a INT);
548+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q, t2.a from t2;
549+
SELECT * from t1;
550+
drop table t1;
551+
CREATE TABLE t1 (a INT);
552+
lock table t1 write,t2 read, sys.sys_config read;
553+
CREATE OR REPLACE TABLE t1 AS SELECT sys.format_statement('SELECT 1') AS q, t2.a from t2;
554+
unlock tables;
555+
select * from t1;
556+
drop table t1,t2;
557+
558+
--echo #
559+
--echo # End of 10.6 tests
560+
--echo #

sql/sql_base.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5157,12 +5157,6 @@ static bool check_lock_and_start_stmt(THD *thd,
51575157
thr_lock_type lock_type;
51585158
DBUG_ENTER("check_lock_and_start_stmt");
51595159

5160-
/*
5161-
Prelocking placeholder is not set for TABLE_LIST that
5162-
are directly used by TOP level statement.
5163-
*/
5164-
DBUG_ASSERT(table_list->prelocking_placeholder == TABLE_LIST::PRELOCK_NONE);
5165-
51665160
/*
51675161
TL_WRITE_DEFAULT and TL_READ_DEFAULT are supposed to be parser only
51685162
types of locks so they should be converted to appropriate other types

0 commit comments

Comments
 (0)