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

Double backslashes reduced to one in routine definition in information_schema.routines

    XMLWordPrintable

Details

    Description

      Double backslashes get reduced to one in routine definition in information_schema.routines

      1. create routine with literal strings

      CREATE 
      PROCEDURE testprocedure(OUT `out1` VARCHAR(255))
      BEGIN
          # double backslash in regex literal 
          # becomes single backslash in information_schema.routines ROUTINE_DEFINITION
          SET out1 = REGEXP_SUBSTR('abc1234ddef', '\\d+');
      END
      

      2. Routine returns 1234

      3. select definition record in information_schema.ROUTINES

      SELECT * FROM information_schema.ROUTINES
      WHERE routine_name = 'testprocedure'
      

      Column ROUTINE_DEFINITION shows routine definition as

      BEGIN
          # double backslash in regex literal 
          # becomes single backslash in information_schema.routines ROUTINE_DEFINITION
          SET out1 = REGEXP_SUBSTR('abc1234ddef', '\d+');
      END
      

      Routine would return 'dd'.

      I read in MDEV-6508 that the ROUTINE_DEFINITION "may not always be used to recreate the routine and won't necessarily be valid SQL" but this missing backslash seems to be a bug anyway.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              KoSchmi Konstantin Schmidt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.