-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* 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>
- Loading branch information
1 parent
9b9a2b6
commit c4e4b68
Showing
16 changed files
with
119 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
8 changes: 8 additions & 0 deletions
8
internal/endtoend/testdata/order_by_non_existing_column/mysql/query.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Example queries for sqlc | ||
CREATE TABLE authors ( | ||
id INT | ||
); | ||
|
||
-- name: ListAuthors :many | ||
SELECT id FROM authors | ||
ORDER BY adfadsf; |
7 changes: 7 additions & 0 deletions
7
internal/endtoend/testdata/order_by_non_existing_column/mysql/sqlc.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 1 | ||
packages: | ||
- path: "go" | ||
name: "querytest" | ||
engine: "postgresql" | ||
schema: "query.sql" | ||
queries: "query.sql" |
2 changes: 2 additions & 0 deletions
2
internal/endtoend/testdata/order_by_non_existing_column/mysql/stderr.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package querytest | ||
query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false |
8 changes: 8 additions & 0 deletions
8
internal/endtoend/testdata/order_by_non_existing_column/postgresql/query.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Example queries for sqlc | ||
CREATE TABLE authors ( | ||
id INT | ||
); | ||
|
||
-- name: ListAuthors :many | ||
SELECT id FROM authors | ||
ORDER BY adfadsf; |
7 changes: 7 additions & 0 deletions
7
internal/endtoend/testdata/order_by_non_existing_column/postgresql/sqlc.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 1 | ||
packages: | ||
- path: "go" | ||
name: "querytest" | ||
engine: "postgresql" | ||
schema: "query.sql" | ||
queries: "query.sql" |
2 changes: 2 additions & 0 deletions
2
internal/endtoend/testdata/order_by_non_existing_column/postgresql/stderr.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package querytest | ||
query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false |
8 changes: 8 additions & 0 deletions
8
internal/endtoend/testdata/order_by_non_existing_column/sqlite/query.sql
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-- Example queries for sqlc | ||
CREATE TABLE authors ( | ||
id INT | ||
); | ||
|
||
-- name: ListAuthors :many | ||
SELECT id FROM authors | ||
ORDER BY adfadsf; |
7 changes: 7 additions & 0 deletions
7
internal/endtoend/testdata/order_by_non_existing_column/sqlite/sqlc.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 1 | ||
packages: | ||
- path: "go" | ||
name: "querytest" | ||
engine: "postgresql" | ||
schema: "query.sql" | ||
queries: "query.sql" |
2 changes: 2 additions & 0 deletions
2
internal/endtoend/testdata/order_by_non_existing_column/sqlite/stderr.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package querytest | ||
query.sql:7:1: column reference "adfadsf" not found: if you want to skip this validation, set 'strict_order_by' to false |