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

Multiple selects from parametrized CTE fails with syntax error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.2, 10.3, 10.2.17, 10.3.9
    • Fix Version/s: 10.2.18
    • Component/s: Optimizer - CTE
    • Labels:
      None

      Description

      The following query works fine:

      PREPARE stmt FROM
      'WITH t1 AS (SELECT 1)
      SELECT * FROM t1
       UNION ALL
      SELECT * FROM t1'
      

      When extracting the "1" into a parameter the query fails with error 1064:

      PREPARE stmt FROM
      'WITH t1 AS (SELECT ?)
      SELECT * FROM t1
       UNION ALL
      SELECT * FROM t1'
      

      Tested on OSX 10.13.6. MySQL 8 seems to handle this without trouble.

        Attachments

          Activity

            People

            Assignee:
            igor Igor Babaev
            Reporter:
            helmutschneider Johan Björk
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: