[MDEV-25501] routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked Created: 2021-04-23  Updated: 2021-04-28  Resolved: 2021-04-28

Status: Closed
Project: MariaDB Server
Component/s: Information Schema
Affects Version/s: 10.3, 10.4, 10.5
Fix Version/s: 10.3.29, 10.4.19, 10.5.10

Type: Bug Priority: Major
Reporter: Azza Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

I'm using MariaDB 10.3.20 but I'm guessing it also affects the latest version...



 Description   

-- sample to reproduce problem
CREATE PROCEDURE test()
BEGIN
  SELECT NULL FROM _table;
END;
 
SHOW CREATE PROCEDURE test;
-- `Create Procedure` contains correct table name
 
SELECT routine_definition FROM information_schema.routines WHERE routine_schema=DATABASE() AND specific_name='test';
-- `routine_definition` contains " SELECT NULL FROM ;" (no table name!)

I can also confirm this happens for triggers:

CREATE TRIGGER test AFTER INSERT ON anytable FOR EACH ROW
BEGIN
SET @x=(SELECT NULL FROM _table);
END;
 
SHOW TRIGGERS;
-- `statement` is missing _table
 
SELECT action_statement FROM information_schema.triggers WHERE trigger_name='test';
-- `ACTION_STATEMENT` is missing _table
 
SHOW CREATE trigger test;
-- SQL Original Statement is correct



 Comments   
Comment by Alice Sherepa [ 2021-04-23 ]

Thanks! I repeated as described on 10.3-10.5, while on 5.5-10.2 tablename is shown.

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