Skip to content

Commit b6f2cc9

Browse files
EliSauderCopilot
andcommitted
test(compiler): cover quoted SQL Server star references
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent d44a092 commit b6f2cc9

4 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎internal/compiler/expand.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ func (c *Compiler) starOldFunc(parts []string) func(string) int {
106106
if hasSeparator := i > 0; hasSeparator {
107107
length++
108108
}
109+
// Use the original identifier below: o may already be quoted by
110+
// quoteIdent, and quoting it again would measure a different name.
109111
if strings.HasPrefix(s[length:], o) {
110112
length += len(o)
111113
} else if quoted := c.quote(parts[i]); strings.HasPrefix(s[length:], quoted) {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"contexts": ["base"]}
1+
{"contexts": ["base", "core"]}

‎internal/endtoend/testdata/mssql_star_escaped_qualifier/mssql/go/query.sql.go‎

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎internal/endtoend/testdata/mssql_star_escaped_qualifier/mssql/query.sql‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ SELECT "x]y".* FROM authors AS "x]y";
66

77
-- name: C :many
88
SELECT [x]]y].* FROM authors AS [x]]y];
9+
10+
-- name: D :many
11+
SELECT "select".* FROM authors AS "select";

0 commit comments

Comments
 (0)