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

Implement an optional list of column names with the derived table name

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • Optimizer, Parser
    • None

    Description

      <table primary> ::=
          ...
          | <derived table> [ AS ] <correlation name>
              [ <left paren> <derived column list> <right paren> ]
          ...
       
      <derived column list> ::= <column name list>
       
      <column name list> ::=
          <column name> [ { <comma> <column name> }... ]
      

      SQL Standard says that with the derived table name an optional list of column names used in this derived table can also be specified. This feature is not implemented in MariaDB.

      The usage of this feature:

      SELECT *
      FROM
      (
        SELECT MAX(a), b
        FROM t1
        GROUP BY b
      ) AS tab(max_a, b);
      

      The most interesting case of using this feature will be with the derived table defined with a table value constructor. In this example there is no possibility to come at 'tab' columns directly.

      SELECT *
      FROM
      (
        VALUES ((1,1),(2,2))
      ) AS tab;
      

      Using the suggested feature it becomes possible:

      SELECT *
      FROM
      (
        VALUES ((1,1),(2,2))
      ) AS tab(a,b)
      SELECT a FROM tab;
      

      Attachments

        Activity

          People

            igor Igor Babaev
            shagalla Galina Shalygina (Inactive)
            Votes:
            11 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.