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

Multiple selects from parametrized CTE fails with syntax error

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.2.17, 10.3.9, 10.2(EOL), 10.3(EOL)
    • 10.2.18
    • Optimizer - CTE
    • 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

          Transition Time In Source Status Execution Times
          Alice Sherepa made transition -
          Open Confirmed
          37m 7s 1
          Igor Babaev (Inactive) made transition -
          Confirmed In Progress
          3d 19h 1
          Igor Babaev (Inactive) made transition -
          In Progress In Review
          2d 1h 1m 1
          Oleksandr Byelkin made transition -
          In Review Stalled
          1d 8h 49m 1
          Igor Babaev (Inactive) made transition -
          Stalled Closed
          1d 7h 37m 1

          People

            igor Igor Babaev (Inactive)
            helmutschneider Johan Björk
            Votes:
            0 Vote for this issue
            Watchers:
            4 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.