mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Fix for bug#15533 crash, information_schema, function, view
enable view prepared mode during getting metedata for I_S table
This commit is contained in:
parent
4b3b1fc0b2
commit
8ce6f3e6ca
3 changed files with 42 additions and 0 deletions
|
@ -1074,3 +1074,19 @@ character_maximum_length character_octet_length
|
||||||
32 32
|
32 32
|
||||||
64 64
|
64 64
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
|
||||||
|
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
|
||||||
|
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
|
||||||
|
CREATE FUNCTION func1() RETURNS BIGINT
|
||||||
|
BEGIN
|
||||||
|
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
|
||||||
|
END//
|
||||||
|
CREATE VIEW v1 AS SELECT 1 FROM t1
|
||||||
|
WHERE f3 = (SELECT func2 ());
|
||||||
|
SELECT func1();
|
||||||
|
func1()
|
||||||
|
1
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP FUNCTION func1;
|
||||||
|
DROP FUNCTION func2;
|
||||||
|
|
|
@ -767,3 +767,26 @@ create table t1(f1 binary(32), f2 varbinary(64));
|
||||||
select character_maximum_length, character_octet_length
|
select character_maximum_length, character_octet_length
|
||||||
from information_schema.columns where table_name='t1';
|
from information_schema.columns where table_name='t1';
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#15533 crash, information_schema, function, view
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (f1 BIGINT, f2 VARCHAR(20), f3 BIGINT);
|
||||||
|
INSERT INTO t1 SET f1 = 1, f2 = 'Schoenenbourg', f3 = 1;
|
||||||
|
|
||||||
|
CREATE FUNCTION func2() RETURNS BIGINT RETURN 1;
|
||||||
|
|
||||||
|
delimiter //;
|
||||||
|
CREATE FUNCTION func1() RETURNS BIGINT
|
||||||
|
BEGIN
|
||||||
|
RETURN ( SELECT COUNT(*) FROM INFORMATION_SCHEMA.VIEWS);
|
||||||
|
END//
|
||||||
|
delimiter ;//
|
||||||
|
|
||||||
|
CREATE VIEW v1 AS SELECT 1 FROM t1
|
||||||
|
WHERE f3 = (SELECT func2 ());
|
||||||
|
SELECT func1();
|
||||||
|
DROP TABLE t1;
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP FUNCTION func1;
|
||||||
|
DROP FUNCTION func2;
|
||||||
|
|
|
@ -2045,6 +2045,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||||
int error= 1;
|
int error= 1;
|
||||||
db_type not_used;
|
db_type not_used;
|
||||||
Open_tables_state open_tables_state_backup;
|
Open_tables_state open_tables_state_backup;
|
||||||
|
bool save_view_prepare_mode= lex->view_prepare_mode;
|
||||||
|
lex->view_prepare_mode= TRUE;
|
||||||
DBUG_ENTER("get_all_tables");
|
DBUG_ENTER("get_all_tables");
|
||||||
|
|
||||||
LINT_INIT(end);
|
LINT_INIT(end);
|
||||||
|
@ -2230,6 +2232,7 @@ err:
|
||||||
lex->derived_tables= derived_tables;
|
lex->derived_tables= derived_tables;
|
||||||
lex->all_selects_list= old_all_select_lex;
|
lex->all_selects_list= old_all_select_lex;
|
||||||
lex->query_tables_last= save_query_tables_last;
|
lex->query_tables_last= save_query_tables_last;
|
||||||
|
lex->view_prepare_mode= save_view_prepare_mode;
|
||||||
*save_query_tables_last= 0;
|
*save_query_tables_last= 0;
|
||||||
lex->sql_command= save_sql_command;
|
lex->sql_command= save_sql_command;
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
|
Loading…
Add table
Reference in a new issue