-
Notifications
You must be signed in to change notification settings - Fork 923
Fix SQLite Update query generation #4028
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
Open
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dosubot
dosubot
bot
added
the
size:XS
This PR changes 0-9 lines, ignoring generated files.
label
Jul 23, 2025
kyleconroy
kyleconroy
requested changes
Aug 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this? It's helpful so that we don't break this in the future.
@dosubot
dosubot
bot
added
size:L
This PR changes 100-499 lines, ignoring generated files.
and removed
size:XS
This PR changes 0-9 lines, ignoring generated files.
labels
Aug 4, 2025
@kyleconroy I added an e2e test for uppercase tables/relations in sqlite. The tests fail when you revert the identifier change in internal/engine/sqlite/convert.go
and succeed with the change present.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Purpose
Resolve the issue described in #3852 where update statements fail when generating queries. Note that this regression was introduced in 1.28.0 and is currently affecting the latest release (1.29.0).
Background
In commit 58b08ae the table names in sqlite queries were normalized (i.e. lower cased). In that commit a number of changes were made in the file
internal/engine/sqlite/convert.go
to lowercase tables names during query parsing so that the table names would always match the table names pulled from the schema even if the casing is different. The linked issue above exists because the table name in update statements was not included in the linked set of changes last year. In essence, if you used an uppercase table name in your update query (i.e.UPDATE MY_TABLE ...
) it will not match the parsed table name which is currently being converted to lowercase (i.e.my_table
).Changes
identifier()
function inconvertUpdate_stmtContext()
so thattableName
is properly cased before it is returned and used.