Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25501

routine_definition in information_schema.routines loses tablename if it starts with an _ and is not backticked

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.3, 10.4, 10.5
    • Fix Version/s: 10.3.29, 10.4.19, 10.5.10
    • Component/s: Information Schema
    • 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
      

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            AzzaAzza69 Azza
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: