Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lovasoa opened this issue Nov 10, 2024 · 1 comment
Closed

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

lovasoa opened this issue Nov 10, 2024 · 1 comment

Comments

@lovasoa
Copy link
Contributor

lovasoa commented Nov 10, 2024

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

@alamb
Copy link
Contributor

alamb commented Dec 12, 2024

I believe this is fixed in #1515 (thanks @wugeer !)

@alamb alamb closed this as completed Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants