Skip to content

Commit dd128fe

Browse files
kyleconroyclaude
andcommitted
fix(expander): use valid MySQL syntax for edge case tests
MySQL doesn't support unqualified `*` mixed with other columns (e.g., `SELECT *, *` or `SELECT id, *, name`). These are valid PostgreSQL but invalid MySQL syntax. Update MySQL tests to use table-qualified stars which are valid: - `SELECT authors.*, authors.*` instead of `SELECT *, *` - `SELECT id, authors.*, name` instead of `SELECT id, *, name` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 3b8932c commit dd128fe

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

internal/x/expander/expander_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,16 @@ func TestExpandMySQL(t *testing.T) {
270270
query: "SELECT authors.* FROM authors",
271271
expected: "SELECT authors.id,authors.name,authors.bio FROM authors;",
272272
},
273+
{
274+
name: "double table qualified star",
275+
query: "SELECT authors.*, authors.* FROM authors",
276+
expected: "SELECT authors.id,authors.name,authors.bio,authors.id,authors.name,authors.bio FROM authors;",
277+
},
278+
{
279+
name: "star in middle of columns table qualified",
280+
query: "SELECT id, authors.*, name FROM authors",
281+
expected: "SELECT id,authors.id,authors.name,authors.bio,name FROM authors;",
282+
},
273283
{
274284
name: "count star not expanded",
275285
query: "SELECT COUNT(*) FROM authors",
@@ -280,9 +290,6 @@ func TestExpandMySQL(t *testing.T) {
280290
query: "SELECT COUNT(*), name FROM authors GROUP BY name",
281291
expected: "SELECT COUNT(*), name FROM authors GROUP BY name", // No change
282292
},
283-
// Note: "double star" and "star in middle of columns" tests are skipped for MySQL
284-
// because the intermediate query formatting produces invalid MySQL syntax.
285-
// These are edge cases that rarely occur in real-world usage.
286293
}
287294

288295
for _, tc := range tests {

0 commit comments

Comments
 (0)