Skip to content

MySQL's CREATE TABLE ... SELECT syntax #1509

Closed
@lovasoa

Description

@lovasoa

SQLite, Postgres, MsSQL and MySQL all support the CREATE TABLE table_name(columns) AS SELECT ....

However, MySQL (and Mariadb) allow omitting the AS keyword, and specifying a table like

CREATE TABLE bar (m INT) SELECT n FROM foo;

Currently, sqlparser parses this as two distinct statements: a create table followed by a select. Instead, it should parse it the same as

CREATE TABLE bar (m INT) AS SELECT n FROM foo;

https://dev.mysql.com/doc/refman/8.4/en/create-table-select.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions