Movatterモバイル変換


[0]ホーム

URL:


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

FixORDER BY arg parsing in sqlite#3962

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andriygm wants to merge2 commits intosqlc-dev:main
base:main
Choose a base branch
Loading
fromandriygm:fix-sqlite-order-by-args

Conversation

andriygm
Copy link

@andriygmandriygm commentedMay 14, 2025
edited
Loading

sqlc currently doesn't handle boundORDER BY clauses in sqlite, nor does it have tests for this behavior. This PR attempts for rectify this.Closes#3788.

ElecTwix reacted with thumbs up emoji
@dosubotdosubotbot added size:LThis PR changes 100-499 lines, ignoring generated files. 🔧 golang labelsMay 14, 2025
@andriygmandriygm marked this pull request as draftMay 14, 2025 14:46
@andriygmandriygm marked this pull request as ready for reviewMay 14, 2025 15:50
@andriygm
Copy link
Author

currently, base behavior works but mixing params like so:

-- name: ListAuthorsColumnSortDirection :manySELECT*FROM authorsWHERE id> ?ORDER BY    CASE        WHEN @order_by='asc' THEN name    ENDASC,    CASE        WHEN @order_by='desc'OR @order_by ISNULL THEN name    ENDDESC;

produces this incorrect output (question marks in CASE clauses should instead be same variable)

-- name: ListAuthorsColumnSortDirection :manySELECT id, name, bioFROM authorsWHERE id> ?ORDER BY    CASE        WHEN ?='asc' THEN name    ENDASC,    CASE        WHEN ?='desc'OR ? ISNULL THEN name    ENDDESC

this can still be worked around by using named params in this case.

@andriygmandriygm changed the titleFixORDER BY clause in sqliteFixORDER BY arg parsing in sqliteMay 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
size:LThis PR changes 100-499 lines, ignoring generated files.🔧 golang
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Args in sqlite ORDER BY not respected
1 participant
@andriygm

[8]ページ先頭

©2009-2025 Movatter.jp