Fix SQLite Update query generation #4028
Open
+1
−1
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.
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.