Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19352

Sql. Create table from query result

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.0.0-beta1
    • None
    • sql
    • Docs Required, Release Notes Required

    Description

      Like in IGNITE-14555 for AI2, it would be useful to create tables from the result of the query:
       

      CREATE TABLE <name> AS <SELECT QUERY>
      

      In the AI3 beta1 and current `main` it's not possible:

      sql-cli> create table xx (key_field INT PRIMARY KEY, field1 INT);
      Updated 0 rows.
      sql-cli> insert into xx values (1, 1);
      Updated 1 rows.
      sql-cli> insert into xx values (2, 10);
      Updated 1 rows.
      sql-cli> create table xy as select key_field, field1 from xx where field1 < 5;
      SQL query execution error
      Exception while executing query [query=create table xy as select key_field, field1 from xx where field1 < 5;]. Error message:IGN-SQL-3 TraceId:ff6bc711-14e5-42ab-b80c-5515a8b77c7c Failed to parse query: Encountered " "AS" "as "" at line 1, column 17.
      Was expecting:
          "(" ...
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              akhitrin Andrey Khitrin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: