-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(mysql): translate UPDATE … FROM … syntax to UPDATE … JOIN … when generating MySQL #6655
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
Changes from 3 commits
96fe4bb
fdf15c6
0f4f9b3
332c368
0480351
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -194,6 +194,17 @@ def test_ddl(self): | |
| self.validate_identity("ALTER TABLE t ALTER COLUMN c SET INVISIBLE") | ||
| self.validate_identity("ALTER TABLE t ALTER COLUMN c SET VISIBLE") | ||
|
|
||
| def test_update_from_to_join(self): | ||
| self.validate_all( | ||
| "UPDATE foo JOIN bar ON TRUE SET a = bar.a WHERE foo.id = bar.id", | ||
| read={ | ||
| "postgres": "UPDATE foo SET a = bar.a FROM bar WHERE foo.id = bar.id", | ||
| }, | ||
| write={ | ||
| "mysql": "UPDATE foo JOIN bar ON TRUE SET a = bar.a WHERE foo.id = bar.id", | ||
|
||
| }, | ||
VaggelisD marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Comment on lines
+218
to
+220
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this isn't correct Postgres it'd be better to remove the test; SQLGlot lives by the "garbage in, garbage out" rule so it's not our responsibility to cover such cases. |
||
| ) | ||
|
|
||
| def test_identity(self): | ||
| self.validate_identity("SELECT HIGH_PRIORITY STRAIGHT_JOIN SQL_CALC_FOUND_ROWS * FROM t") | ||
| self.validate_identity("SELECT CAST(COALESCE(`id`, 'NULL') AS CHAR CHARACTER SET binary)") | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.