Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.35.0
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
- links to