From f8dda7bfb928c0eaee550db57f5288e0575ea378 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Jul 2006 16:42:19 -0700 Subject: Added a test case with views for bug #17526. mysql-test/r/func_str.result: Adjusted results for the test case of bug 17526. sql/item_strfunc.cc: Post-merge modification --- mysql-test/t/view.test | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/t/view.test') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 88a4d489039..6399cef9086 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2643,3 +2643,27 @@ DESCRIBE t2; DROP VIEW v1; DROP TABLE t1,t2; + +# +# Bug #17526: views with TRIM functions +# + +CREATE TABLE t1 (s varchar(10)); +INSERT INTO t1 VALUES ('yadda'), ('yady'); + +SELECT TRIM(BOTH 'y' FROM s) FROM t1; +CREATE VIEW v1 AS SELECT TRIM(BOTH 'y' FROM s) FROM t1; +SELECT * FROM v1; +DROP VIEW v1; + +SELECT TRIM(LEADING 'y' FROM s) FROM t1; +CREATE VIEW v1 AS SELECT TRIM(LEADING 'y' FROM s) FROM t1; +SELECT * FROM v1; +DROP VIEW v1; + +SELECT TRIM(TRAILING 'y' FROM s) FROM t1; +CREATE VIEW v1 AS SELECT TRIM(TRAILING 'y' FROM s) FROM t1; +SELECT * FROM v1; +DROP VIEW v1; + +DROP TABLE t1; -- cgit v1.2.1 From 1b3cdb6085c944e1c371779d4d4b6473ebcd116d Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Jul 2006 18:42:49 +0300 Subject: Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called When executing INSERT over a view with calculated columns it was assuming all elements of the fields collection are actually Item_field instances. This may not be true when inserting into a view and that view has columns that are such expressions that allow updating (like setting a collation for example). Corrected to access field information through the filed_for_view_update() function and retrieve correctly the field info even for "update-friendly" non-Item_field items. mysql-test/r/view.result: Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called - test suite mysql-test/t/view.test: Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called - test suite sql/item_strfunc.h: Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called - obvious typo fixed sql/sql_base.cc: Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called - must access field information through the filed_for_view_update() function to retrieve correctly the field info even for "update-friendly" non-Item_field items. --- mysql-test/t/view.test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'mysql-test/t/view.test') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6399cef9086..1b930353ca4 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2667,3 +2667,22 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +# +# Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE +# clause is called +# +CREATE TABLE t1 (s1 char); +INSERT INTO t1 VALUES ('Z'); + +CREATE VIEW v1 AS SELECT s1 collate latin1_german1_ci AS col FROM t1; + +CREATE VIEW v2 (col) AS SELECT s1 collate latin1_german1_ci FROM t1; + +# either of these statements will cause crash +INSERT INTO v1 (col) VALUES ('b'); +INSERT INTO v2 (col) VALUES ('c'); + +SELECT s1 FROM t1; +DROP VIEW v1, v2; +DROP TABLE t1; -- cgit v1.2.1 From c8673b09b871f5c6d55ce69e8302dbf0e5b2c348 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jul 2006 17:33:37 +0300 Subject: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM When executing ALTER TABLE all the attributes of the view were overwritten. This is contrary to the user's expectations. So some of the view attributes are preserved now : namely security and algorithm. This means that if they are not specified in ALTER VIEW their values are preserved from CREATE VIEW instead of being defaulted. mysql-test/r/view.result: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - test suite mysql-test/t/view.test: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - test suite sql/sql_lex.h: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified sql/sql_view.cc: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - open the view to get it's attributes and put then as defaults for ALTER VIEW sql/sql_yacc.yy: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified sql/table.h: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified --- mysql-test/t/view.test | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'mysql-test/t/view.test') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 6399cef9086..5db9030eece 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2667,3 +2667,16 @@ SELECT * FROM v1; DROP VIEW v1; DROP TABLE t1; + +# +#Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM +# +CREATE TABLE t1 (x INT, y INT); +CREATE ALGORITHM=TEMPTABLE SQL SECURITY INVOKER VIEW v1 AS SELECT x FROM t1; +SHOW CREATE VIEW v1; + +ALTER VIEW v1 AS SELECT x, y FROM t1; +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; -- cgit v1.2.1 From b74cb62348c2815c63452dd4d6c50c2510302a6e Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Jul 2006 20:56:06 +0300 Subject: Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE made DROP VIEW to continue on error and report an aggregated error at its end. This makes it similar to DROP TABLE. mysql-test/r/view.result: Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE - test case - changed error message mysql-test/t/view.test: Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE - test case sql/sql_view.cc: Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE - made DROP VIEW to continue on error and report an aggregated error --- mysql-test/t/view.test | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'mysql-test/t/view.test') diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 1b930353ca4..599b00f3fd1 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -2686,3 +2686,24 @@ INSERT INTO v2 (col) VALUES ('c'); SELECT s1 FROM t1; DROP VIEW v1, v2; DROP TABLE t1; + +# +# Bug #11551: Asymmetric + undocumented behaviour of DROP VIEW and DROP TABLE +# +CREATE TABLE t1 (id INT); +CREATE VIEW v1 AS SELECT id FROM t1; +SHOW TABLES; + +--error 1051 +DROP VIEW v2,v1; +SHOW TABLES; + +CREATE VIEW v1 AS SELECT id FROM t1; +--error 1347 +DROP VIEW t1,v1; +SHOW TABLES; + +DROP TABLE t1; +--disable_warnings +DROP VIEW IF EXISTS v1; +--enable_warnings -- cgit v1.2.1