MDEV-23823 Crash in SELECT NEXT VALUE on locked view
Make open_table() fail if sequence should be opened, but it turns out to be locked view.
This commit is contained in:
parent
d9d9c30b70
commit
a6987d9fb9
@ -534,3 +534,12 @@ select next value for s;
|
|||||||
next value for s
|
next value for s
|
||||||
-999
|
-999
|
||||||
drop sequence s;
|
drop sequence s;
|
||||||
|
#
|
||||||
|
# MDEV-23823 NEXT VALUE crash on locked view
|
||||||
|
#
|
||||||
|
CREATE VIEW v AS SELECT 1;
|
||||||
|
LOCK TABLE v READ;
|
||||||
|
SELECT NEXT VALUE FOR v;
|
||||||
|
ERROR 42S02: 'test.v' is not a SEQUENCE
|
||||||
|
UNLOCK TABLES;
|
||||||
|
DROP VIEW v;
|
||||||
|
@ -280,3 +280,13 @@ select next value for s;
|
|||||||
flush tables;
|
flush tables;
|
||||||
select next value for s;
|
select next value for s;
|
||||||
drop sequence s;
|
drop sequence s;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-23823 NEXT VALUE crash on locked view
|
||||||
|
--echo #
|
||||||
|
CREATE VIEW v AS SELECT 1;
|
||||||
|
LOCK TABLE v READ;
|
||||||
|
--error ER_NOT_SEQUENCE
|
||||||
|
SELECT NEXT VALUE FOR v;
|
||||||
|
UNLOCK TABLES;
|
||||||
|
DROP VIEW v;
|
||||||
|
@ -1724,7 +1724,14 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_locked_view(thd, table_list))
|
if (is_locked_view(thd, table_list))
|
||||||
|
{
|
||||||
|
if (table_list->sequence)
|
||||||
|
{
|
||||||
|
my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
|
||||||
|
DBUG_RETURN(true);
|
||||||
|
}
|
||||||
DBUG_RETURN(FALSE); // VIEW
|
DBUG_RETURN(FALSE); // VIEW
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
No table in the locked tables list. In case of explicit LOCK TABLES
|
No table in the locked tables list. In case of explicit LOCK TABLES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user