Bug #47031 view test case fails

Submitted: 31 Aug 2009 23:43 Modified: 1 Sep 2009 6:21
Reporter: BJ Dierkes Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.0.85 OS:Linux (Red Hat Enterprise Linux)
Assigned to: CPU Architecture:Any
Tags: Tests, VIEW

[31 Aug 2009 23:43] BJ Dierkes
Description:
The 'view' test case fails... looks to me like the test case is jacked, and not that the server is actually failing.

view                           [ fail ]
--- /builddir/build/BUILD/mysql-5.0.85/mysql-test/r/view.result 2009-08-11 14:18:01.000000000 +0300
+++ /builddir/build/BUILD/mysql-5.0.85/mysql-test/r/view.reject 2009-09-01 02:34:15.000000000 +0300
@@ -3659,6 +3659,51 @@
 
 # -- End of test case for Bug#34337.
 
+# -----------------------------------------------------------------
+# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
+# --           causing syntax error
+# -----------------------------------------------------------------
+
+CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
+
+SELECT * FROM v1;
+1
+1
+SHOW CREATE TABLE v1;
+View   Create View
+v1     CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from DUAL  where 1
+
+DROP VIEW v1;
+
+# -- End of test case for Bug#35193.
+
+CREATE VIEW v1 AS SELECT 1;
+DROP VIEW v1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
+INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
+SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
+c1     c2
+2      2
+SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
+c1     c2
+2      2
+CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
+SHOW INDEX FROM v1;
+Table  Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality       Sub_part        Packed  Null    Index_type      Comment
+SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
+ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
+SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
+ERROR HY000: Key 'c2' doesn't exist in table 'v1'
+DROP VIEW v1;
+DROP TABLE t1;
 # 
 # Bug #45806 crash when replacing into a view with a join!
 # 
@@ -3771,51 +3816,6 @@
 DROP TABLE t1;
 # -- End of test case for Bug#45806
 # -----------------------------------------------------------------
-# -- Bug#35193 VIEW query is rewritten without "FROM DUAL",
-# --           causing syntax error
-# -----------------------------------------------------------------
-
-CREATE VIEW v1 AS SELECT 1 FROM DUAL WHERE 1;
-
-SELECT * FROM v1;
-1
-1
-SHOW CREATE TABLE v1;
-View   Create View
-v1     CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1` from DUAL  where 1
-
-DROP VIEW v1;
-
-# -- End of test case for Bug#35193.
-
-CREATE VIEW v1 AS SELECT 1;
-DROP VIEW v1;
-CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 INT, INDEX (c2));
-INSERT INTO t1 VALUES (1,1), (2,2), (3,3);
-SELECT * FROM t1 USE INDEX (PRIMARY) WHERE c1=2;
-c1     c2
-2      2
-SELECT * FROM t1 USE INDEX (c2) WHERE c2=2;
-c1     c2
-2      2
-CREATE VIEW v1 AS SELECT c1, c2 FROM t1;
-SHOW INDEX FROM v1;
-Table  Non_unique      Key_name        Seq_in_index    Column_name     Collation       Cardinality       Sub_part        Packed  Null    Index_type      Comment
-SELECT * FROM v1 USE INDEX (PRIMARY) WHERE c1=2;
-ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
-SELECT * FROM v1 FORCE INDEX (PRIMARY) WHERE c1=2;
-ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
-SELECT * FROM v1 IGNORE INDEX (PRIMARY) WHERE c1=2;
-ERROR HY000: Key 'PRIMARY' doesn't exist in table 'v1'
-SELECT * FROM v1 USE INDEX (c2) WHERE c2=2;
-ERROR HY000: Key 'c2' doesn't exist in table 'v1'
-SELECT * FROM v1 FORCE INDEX (c2) WHERE c2=2;
-ERROR HY000: Key 'c2' doesn't exist in table 'v1'
-SELECT * FROM v1 IGNORE INDEX (c2) WHERE c2=2;
-ERROR HY000: Key 'c2' doesn't exist in table 'v1'
-DROP VIEW v1;
-DROP TABLE t1;
-# -----------------------------------------------------------------
 # -- Bug#40825: Error 1356 while selecting from a view 
 # --            with a "HAVING" clause though query works
 # -----------------------------------------------------------------
mysqltest: Result content mismatch
Aborting: view failed in default mode. 
To continue, re-run with '--force'.
Stopping All Servers

How to repeat:
make && make test
[1 Sep 2009 3:39] Valeriy Kravchuk
Test passed with recent 5.0.86 from bzr on Mac OS X.
[1 Sep 2009 6:21] Sveta Smirnova
Thank you for the report.

I can  not repeat described behavior with current development sources, although bug is repeatable with version 5.0.85. Please wait next release.
[1 Sep 2009 11:06] MySQL Verification Team
I wasn't able to repeat on Ubuntu 64-bit too.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.042 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.