Bug#30689 Wrong content in I_S.VIEWS.VIEW_DEFINITION if VIEW is based on I_S

view_body_utf8 attribute type is changed to 'escaped string'
parent ca2c93fc
...@@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI ...@@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
NULL mysqltest1 v1 SELECT '' AS c1, AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci NULL mysqltest1 v1 SELECT '' AS c1, AS c2
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
...@@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI ...@@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
NULL mysqltest1 v1 SELECT '' AS c1, AS c2 NONE YES root@localhost DEFINER koi8r koi8r_general_ci NULL mysqltest1 v1 SELECT '' AS c1, AS c2
FROM t1 NONE YES root@localhost DEFINER koi8r koi8r_general_ci
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
......
...@@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI ...@@ -29,7 +29,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
...@@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI ...@@ -68,7 +69,8 @@ v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v1'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2 NONE YES root@localhost DEFINER utf8 utf8_general_ci NULL mysqltest1 v1 SELECT 'тест' AS c1, кол AS c2
FROM t1 NONE YES root@localhost DEFINER utf8 utf8_general_ci
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'| SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE table_name = 'v2'|
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
......
...@@ -387,10 +387,14 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par ...@@ -387,10 +387,14 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
select * from information_schema.views where TABLE_NAME like "v%"; select * from information_schema.views where TABLE_NAME like "v%";
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION
NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci NULL test v0 select schema_name from information_schema.schemata NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
NULL test v1 select table_name from information_schema.tables NONE NO root@localhost DEFINER latin1 latin1_swedish_ci NULL test v1 select table_name from information_schema.tables
NULL test v2 select column_name from information_schema.columns NONE NO root@localhost DEFINER latin1 latin1_swedish_ci where table_name="v1" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets NONE NO root@localhost DEFINER latin1 latin1_swedish_ci NULL test v2 select column_name from information_schema.columns
NULL test v4 select COLLATION_NAME from information_schema.collations NONE NO root@localhost DEFINER latin1 latin1_swedish_ci where table_name="v2" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
NULL test v3 select CHARACTER_SET_NAME from information_schema.character_sets
where CHARACTER_SET_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
NULL test v4 select COLLATION_NAME from information_schema.collations
where COLLATION_NAME like "latin1%" NONE NO root@localhost DEFINER latin1 latin1_swedish_ci
drop view v0, v1, v2, v3, v4; drop view v0, v1, v2, v3, v4;
create table t1 (a int); create table t1 (a int);
grant select,update,insert on t1 to mysqltest_1@localhost; grant select,update,insert on t1 to mysqltest_1@localhost;
...@@ -1540,4 +1544,12 @@ count(*) ...@@ -1540,4 +1544,12 @@ count(*)
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting'; select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
count(*) count(*)
0 0
CREATE VIEW v1
AS SELECT *
FROM INFORMATION_SCHEMA.TABLES;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
VIEW_DEFINITION
SELECT *
FROM INFORMATION_SCHEMA.TABLES
DROP VIEW v1;
End of 5.1 tests. End of 5.1 tests.
...@@ -1178,4 +1178,14 @@ select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TA ...@@ -1178,4 +1178,14 @@ select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TA
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME=''; select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysql' AND TABLE_NAME='';
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME=''; select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='';
select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting'; select count(*) from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='' AND TABLE_NAME='nonexisting';
#
# Bug#30689 Wrong content in I_S.VIEWS.VIEW_DEFINITION if VIEW is based on I_S
#
CREATE VIEW v1
AS SELECT *
FROM INFORMATION_SCHEMA.TABLES;
SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS where TABLE_NAME = 'v1';
DROP VIEW v1;
--echo End of 5.1 tests. --echo End of 5.1 tests.
...@@ -672,7 +672,7 @@ static File_option view_parameters[]= ...@@ -672,7 +672,7 @@ static File_option view_parameters[]=
FILE_OPTIONS_STRING}, FILE_OPTIONS_STRING},
{{(char*) STRING_WITH_LEN("view_body_utf8")}, {{(char*) STRING_WITH_LEN("view_body_utf8")},
my_offsetof(TABLE_LIST, view_body_utf8), my_offsetof(TABLE_LIST, view_body_utf8),
FILE_OPTIONS_STRING}, FILE_OPTIONS_ESTRING},
{{NullS, 0}, 0, {{NullS, 0}, 0,
FILE_OPTIONS_STRING} FILE_OPTIONS_STRING}
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment