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

feat(planner): support settings set sql_dialect #7175

Merged
merged 2 commits into from
Aug 18, 2022

Conversation

b41sh
Copy link
Member

@b41sh b41sh commented Aug 18, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Support settings set sql_dialect

Fixes #7131

@vercel
Copy link

vercel bot commented Aug 18, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
databend ✅ Ready (Inspect) Visit Preview Aug 18, 2022 at 4:01PM (UTC)

@mergify mergify bot added the pr-feature this PR introduces a new feature to the codebase label Aug 18, 2022
@sundy-li
Copy link
Member

Need a test file in logictest.

For example:

set sql_dialect = 'xxxx';

select "33";

@leiysky
Copy link
Contributor

leiysky commented Aug 19, 2022

@b41sh

We should provide a default SQL dialect for databend.

Before persisting any of the SQL query, the SQL text must be normalized into default dialect. Otherwise we will encounter bugs if user is creating a view with MySQL dialect but query with default dialect.

For example, user is creating a view with create view v as select "A" from t in MySQL dialect, then the token "A" is ambigious, which is impossible to be fixed.

@BohuTANG BohuTANG mentioned this pull request Aug 19, 2022
43 tasks
@b41sh
Copy link
Member Author

b41sh commented Aug 19, 2022

@b41sh

We should provide a default SQL dialect for databend.

Before persisting any of the SQL query, the SQL text must be normalized into default dialect. Otherwise we will encounter bugs if user is creating a view with MySQL dialect but query with default dialect.

For example, user is creating a view with create view v as select "A" from t in MySQL dialect, then the token "A" is ambigious, which is impossible to be fixed.

the default SQL dialect is PostgreSQL, can we rewrite the view query to PostgreSQL?

@b41sh
Copy link
Member Author

b41sh commented Aug 19, 2022

@leiysky the subquery of view is formatted as PostgreSQL dialect. When querying, whether it is MySQL or PostgreSQL dialect, we can get the correct results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Add Setting sql_dialect to control the dialect of parser
4 participants