Skip to content
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

CREATE TABLE ... WITH ... SELECT not supported #255

Open
nicktobey opened this issue Jul 17, 2023 · 1 comment
Open

CREATE TABLE ... WITH ... SELECT not supported #255

nicktobey opened this issue Jul 17, 2023 · 1 comment

Comments

@nicktobey
Copy link

Example query:

CREATE TABLE test
WITH ab AS (
    SELECT 1 as a, 2 as b
)
SELECT * from ab

Our response:

Error parsing SQL:
syntax error at position 23 near 'WITH'
CREATE TABLE test
WITH ab AS (
     ^

The MySQL documentation says this is explicitly allowed (https://dev.mysql.com/doc/refman/8.0/en/with.html) and it works in MySql.

@nicktobey
Copy link
Author

Workaround:

CREATE TABLE test (a int, b int);
INSERT INTO test 
WITH ab AS (
    SELECT 1 as a, 2 as b
)
SELECT * from ab;

So it looks like we're able to parse WITH expressions on DML commands, we just don't also apply that to CREATE.

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

1 participant