Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-6022

Support "CREATE TABLE ... LIKE" DDL in server module

    XMLWordPrintableJSON

Details

    Description

      "CREATE TABLE ... LIKE" is SQL standard syntax, and some other dbms(mysql, postgresql, sparksql) support it. So I think it is worth implementing.
      Syntax:

      CREATE TABLE [IF NOT EXISTS] table_name 
      LIKE source_table [ like_option ... ]

      And for the `like_option`,  I think the syntax of postgreSQL is more flexible and powerful, and I believe it is reasonable to be similar to postgreSQL. But there are not so many attributes in calcite, just keep GENERATED, DEFAULTS and ALL.

      { INCLUDING | EXCLUDING } { GENERATED | DEFAULTS | ALL }

      Some related link:

      https://www.postgresql.org/docs/current/sql-createtable.html

      https://ronsavage.github.io/SQL/sql-2003-2.bnf.html#table%20definition 

      https://dev.mysql.com/doc/refman/8.0/en/create-table-like.html 

       

      Attachments

        Issue Links

          Activity

            People

              hongyuguo hongyu guo
              hongyuguo hongyu guo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: