hongyu guo created CALCITE-6022:
-----------------------------------

             Summary: Support "CREATE TABLE ... LIKE" DDL
                 Key: CALCITE-6022
                 URL: https://issues.apache.org/jira/browse/CALCITE-6022
             Project: Calcite
          Issue Type: New Feature
          Components: server
    Affects Versions: 1.35.0
            Reporter: hongyu guo
             Fix For: 1.36.0


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

 

syntax:

 
{code:java}
CREATE TABLE [IF NOT EXISTS] table_name 
LIKE source_table [ like_option ... ]{code}
 

 

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 CONSTRAINTS DEFAULTS and 
ALL.
{code:java}
{ INCLUDING | EXCLUDING } { CONSTRAINTS | DEFAULTS | ALL }{code}
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] 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to