Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
compiledpanda wants to merge 2 commits into sqlc-dev:main
base: main
Choose a base branch
Loading
from compiledpanda:main

Conversation

Copy link

@compiledpanda compiledpanda commented Jul 23, 2025
edited
Loading

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

  • Call the identifier() function in convertUpdate_stmtContext() so that tableName is properly cased before it is returned and used.

Jack-Punter and bck01215 reacted with thumbs up emoji
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 23, 2025
Copy link
Collaborator

@kyleconroy kyleconroy left a 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
Copy link
Author

@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
Reviewers

@kyleconroy kyleconroy Awaiting requested review from kyleconroy

Assignees
No one assigned
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /