[MDEV-20411] Procedure containing CTE incorrectly stored in mysql.proc Created: 2019-08-22  Updated: 2021-06-29  Resolved: 2021-06-29

Status: Closed
Project: MariaDB Server
Component/s: Optimizer - CTE, Stored routines
Affects Version/s: 10.2
Fix Version/s: 10.2.40

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: not-10.3, not-10.4


 Description   

Only reproducible on 10.2.

CREATE PROCEDURE p () WITH cte AS ( SELECT 1 ) SELECT * FROM cte;
CALL p();

10.2 12e3ac04

mysqltest: At line 2: query 'CALL p()' failed: 1457: Failed to load routine test.p. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)

Note wrong body:

select * from mysql.proc where name = 'p';
db	test
name	p
type	PROCEDURE
specific_name	p
language	SQL
sql_data_access	CONTAINS_SQL
is_deterministic	NO
security_type	DEFINER
param_list	
returns	
body	cte AS ( SELECT 1 ) SELECT * FROM cte
definer	root@localhost
created	2019-08-23 02:50:38
modified	2019-08-23 02:50:38
sql_mode	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
comment	
character_set_client	latin1
collation_connection	latin1_swedish_ci
db_collation	latin1_swedish_ci
body_utf8	cte AS ( SELECT 1 ) SELECT * FROM cte



 Comments   
Comment by Igor Babaev [ 2021-06-29 ]

A fix for this bug was pushed into 10.2. Only changes in test files must be merged upstream.

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