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

SHOW CREATE SERVER emits non-replayable SQL for a quoted wrapper

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 13.0.1
    • 11.8.9, 12.3.3, 13.0.2
    • Server
    • None
    • Docker-based MariaDB 13.0.1 runtime (exact image ID, host OS/architecture, compiler/build information, and my.cnf not retained; runtime image not built from source snapshot b2a8c2234dbc276fe3947633c9ffea454badf48f)
    • Not for Release Notes

    Description

      Description

      When a `CREATE SERVER` `FOREIGN DATA WRAPPER` value contains a single quote, `SHOW CREATE SERVER` emits the value as an unquoted identifier. The resulting statement is syntactically invalid and cannot recreate the server object.

      In two runs, `SHOW CREATE SERVER` produced `FOREIGN DATA WRAPPER my'sql`; replaying the statement after dropping the object returned error 1064. A normal `mysql` wrapper is the control and produces replayable SQL.

      The reviewed output path uses identifier formatting for the stored wrapper value. The source location is `sql/sql_show.cc:1571-1578`. This implementation observation is supplemental to the runtime evidence.

      How to Repeat

      DROP SERVER IF EXISTS `show_server_repro`;
      CREATE SERVER `show_server_repro`
      FOREIGN DATA WRAPPER 'my''sql'
      OPTIONS (HOST 'localhost');
       
      SHOW CREATE SERVER `show_server_repro`;
      

      Copy the statement from the second result column, drop the object, and replay the generated statement:

      DROP SERVER `show_server_repro`;
      -- Execute the CREATE SERVER text returned above.
      

      For the control, use `FOREIGN DATA WRAPPER mysql` and repeat the `SHOW CREATE`, drop, and replay sequence.

      Actual Result

      `SHOW CREATE SERVER` emits:

      CREATE SERVER `show_server_repro`
      FOREIGN DATA WRAPPER my'sql
      OPTIONS (HOST 'localhost');
      

      Replaying the output returns `ERROR 1064` in both positive runs.

      Expected Result

      `SHOW CREATE SERVER` should produce SQL that losslessly recreates the object, using quoting and escaping appropriate for the wrapper's stored string value.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              Mizuki Zhang Baoren
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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