-
Notifications
You must be signed in to change notification settings - Fork 778
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
ORDER BY does not enforce column to exist #1411
Comments
theFong
added
bug
Something isn't working
triage
New issues that hasn't been reviewed
labels
Feb 2, 2022
kyleconroy
added
📚 mysql
💻 darwin
and removed
triage
New issues that hasn't been reviewed
labels
Feb 3, 2022
It would be great if sqlc could enforce validity of ORDER BY columns. We just had a regression because of dropped columns that were not removed from queries, and it passed straight through generation. FWIW, we use Postgres. |
akutschera
added a commit
to akutschera/sqlc
that referenced
this issue
Oct 27, 2022
You are right. While there was code for checking "GROUP BY" clauses, the "ORDER BY" checks were missing. The commit above should fix that. |
akutschera
added a commit
to akutschera/sqlc
that referenced
this issue
Nov 10, 2022
akutschera
added a commit
to akutschera/sqlc
that referenced
this issue
Nov 12, 2022
akutschera
added a commit
to akutschera/sqlc
that referenced
this issue
Nov 12, 2022
Tell the uses how to switch off validation here.
akutschera
added a commit
to akutschera/sqlc
that referenced
this issue
Nov 12, 2022
kyleconroy
added a commit
that referenced
this issue
Jun 8, 2023
* fix: check column references in ORDER BY (#1411) * test: move test cases to endtoend tests * feat: add validate_order_by config option #1411 * feat: expand error message #1411 Tell the uses how to switch off validation here. * feat: add expanded error message to test #1411 * compiler: Add functions to the compiler struct Don't pass configuration around as a parameter --------- Co-authored-by: Kyle Conroy <kyle@conroy.org>
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
1.11.0
What happened?
When creating a query that orders by a non-existent column, sqlc does not emit a
query.sql:x:y: column "adfadsf" does not exist
error.Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/9b40e9e704f08dc389049f02786f9d072d0c51839a432ff196dadcdfa6b19900
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: