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

Add support for LIMIT in subqueries in the IN (...) clause

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Optimizer
    • None

    Description

      Other databases (like PostgreSQL) allow to use subqueries that get limited number of rows in the IN(...) clause, similar to this:

      SELECT ... FROM ... WHERE outer_expr IN (SELECT inner_expr FROM ... [ORDER BY ...] LIMIT n)

      and the semantics is to first apply the LIMIT clause to the subquery output and then make the "outer_col IN (...)" check.

      It would be nice to add support for this specific case of LIMIT in subqueries (with ORDER BY or without), as now we get a generic error message:

      ERROR 1235 (42000): This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'

      This specific case of IN subquery support should be implemented separately as it conflicts with current IN->EXISTS rewrite that is unique to IN subqueries.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              valerii Valerii Kravchuk
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.