[MDEV-13998] PREPARE still doesn't work as expected & throws errors but MySQL is working fine Created: 2017-10-04  Updated: 2017-10-09  Resolved: 2017-10-09

Status: Closed
Project: MariaDB Server
Component/s: Optimizer, Optimizer - CTE, Prepared Statements, Views
Affects Version/s: 10.2.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Gert Straubert Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: optimizer
Environment:

Windows 7


Issue Links:
Duplicate
duplicates MDEV-13753 CTE is not visible during view creation Closed

 Description   

Bug issue no. 13436 (https://jira.mariadb.org/browse/MDEV-13436) reported two issues with PREPARE statements. Both should be fixed with the new MariaDB Version 10.2.9 but only the 1st one is fixed and the 2nd one not. Could you please double check this case?

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.2.9-MariaDB mariadb.org binary distribution
 
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [anaedv]> USE test;
Database changed
MariaDB [test]>
MariaDB [test]> SET @sql_query = "
    ">
    ">   CREATE OR REPLACE VIEW cte_test AS
    ">
    ">    WITH  cte1  AS ( SELECT 1 )
    ">
    ">     ,    cte2  AS ( SELECT * FROM cte1 )
    ">
    ">     SELECT * FROM cte2;
    ">
    "> ";
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [test]>
MariaDB [test]> PREPARE stmt FROM @sql_query;
ERROR 1146 (42S02): Table 'test.cte1' doesn't exist
MariaDB [test]>

This is the exact same error message as before 10.2.9. MySQL 8.0.2 Alpha returns the correct result. Update: The new MySQL 8.0.3 RC is working fine too.

Thanks
Gert



 Comments   
Comment by Elena Stepanova [ 2017-10-09 ]

gertstraubert, while analyzing MDEV-13436, sanja found out that those two issues are unrelated, and extracted the one about prepared statement / CTE into a separate one, which is still open: MDEV-13753.

Generated at Thu Feb 08 08:10:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.