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

MySQL - CREATE TABLE foo SELECT * FROM bar statement causes Found unparsable section error #5852

Open
2 of 3 tasks
gdubicki opened this issue May 6, 2024 · 2 comments
Open
2 of 3 tasks
Labels
bug Something isn't working mysql

Comments

@gdubicki
Copy link

gdubicki commented May 6, 2024

Search before asking

  • I searched the issues and found no similar issues.

What Happened

I am trying to validate some SQL scripts that create syntax like:

CREATE TABLE foo SELECT * FROM bar;

Expected Behaviour

This syntax should work as MySQL supports it.

Observed Behaviour

$ sqlfluff lint --dialect mysql my_script.sql 
== [my_script.sql] FAIL                                                                                                                                          
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'CREATE
                       | TABLE foo SELECT * FROM bar;'
WARNING: Parsing errors found and dialect is set to 'mysql'. Have you configured your dialect correctly?
All Finished 📜 🎉!

How to reproduce

  1. Create a my_script.sql file:
CREATE TABLE foo SELECT * FROM bar;
  1. Try to lint it with:
sqlfluff lint --dialect mysql my_script.sql 

Dialect

MySQL

Version

$ sqlfluff --version
sqlfluff, version 3.0.5

...installed using pipx, Python 3.11.8.

Configuration

Default

Are you willing to work on and submit a PR to address the issue?

  • Yes I am willing to submit a PR!

Code of Conduct

@gdubicki gdubicki added the bug Something isn't working label May 6, 2024
@github-actions github-actions bot added the mysql label May 6, 2024
@gdubicki
Copy link
Author

gdubicki commented May 6, 2024

Yes I am willing to submit a PR!

I am generally open to that, but I am not a SQL specialist so that's why I haven't checked it.

@MarkMarine
Copy link

I'm seeing the same parsing error when using CREATE FUNCTION ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mysql
Projects
None yet
Development

No branches or pull requests

2 participants