Details
-
Bug
-
Status: Open (View Workflow)
-
Critical
-
Resolution: Unresolved
-
13.2
-
None
Description
Anchored type declarations and the db.seq.NEXTVAL / db.seq.CURRVAL syntax build the Table_ident directly, not through LEX::make_table_ident(), so the database name is not checked. In default old_mode a routine can read column types from a table in a #mysql50# database, and NEXTVAL advances a sequence there. %TYPE and %ROWTYPE in sql_mode=ORACLE behave the same.
--source include/have_sequence.inc
|
let $D= `select @@datadir`; |
--mkdir $D/d-b
|
set old_mode=MYSQL50_TABLE_NAMES; |
create table `#mysql50#d-b`.t1 (a varchar(7)); |
create sequence `#mysql50#d-b`.s; |
set old_mode=default; |
--error ER_WRONG_DB_NAME
|
select nextval(`#mysql50#d-b`.s); |
--echo # BUG if the statements below are accepted
|
delimiter $$;
|
create function f1() returns text begin declare v type of `#mysql50#d-b`.t1.a default 'abcdefghijkl'; return v; end $$ |
create function f2() returns text begin declare r row type of `#mysql50#d-b`.t1; set r.a='abcdefghijkl'; return r.a; end $$ |
delimiter ;$$
|
--error ER_DATA_TOO_LONG
|
select f1(); |
--error ER_DATA_TOO_LONG
|
select f2(); |
set sql_mode=oracle; |
select "#mysql50#d-b".s.nextval; |
set sql_mode=default; |
drop function f1; |
drop function f2; |
set old_mode=MYSQL50_TABLE_NAMES; |
drop database `#mysql50#d-b`; |
13.2.0-MariaDB-asan-debug-log source revision: bd4d5680ca4e7d8fd3b953e9f9d342599ac5c07c
|
 |
select nextval(`#mysql50#d-b`.s);
|
ERROR 42000: Incorrect database name '#mysql50#d-b'
|
select f1();
|
ERROR 22001: Data too long for column 'a' at row 0
|
select f2();
|
ERROR 22001: Data too long for column 'a' at row 0
|
set sql_mode=oracle;
|
select "#mysql50#d-b".s.nextval;
|
"#mysql50#d-b".s.nextval
|
1
|
Attachments
Issue Links
- relates to
-
MDEV-40406 hide #mysql50# prefix support behind the old mode
-
- Stalled
-