Skip to content
Prev Previous commit
Next Next commit
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]>
  • Loading branch information
kyleconroy and claude committed Dec 1, 2025
commit dd128fe5f11d3fd4444d05cc511c75c7d5fc6559
13 changes: 10 additions & 3 deletions internal/x/expander/expander_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ func TestExpandMySQL(t *testing.T) {
query: "SELECT authors.* FROM authors",
expected: "SELECT authors.id,authors.name,authors.bio FROM authors;",
},
{
name: "double table qualified star",
query: "SELECT authors.*, authors.* FROM authors",
expected: "SELECT authors.id,authors.name,authors.bio,authors.id,authors.name,authors.bio FROM authors;",
},
{
name: "star in middle of columns table qualified",
query: "SELECT id, authors.*, name FROM authors",
expected: "SELECT id,authors.id,authors.name,authors.bio,name FROM authors;",
},
{
name: "count star not expanded",
query: "SELECT COUNT(*) FROM authors",
Expand All @@ -280,9 +290,6 @@ func TestExpandMySQL(t *testing.T) {
query: "SELECT COUNT(*), name FROM authors GROUP BY name",
expected: "SELECT COUNT(*), name FROM authors GROUP BY name", // No change
},
// Note: "double star" and "star in middle of columns" tests are skipped for MySQL
// because the intermediate query formatting produces invalid MySQL syntax.
// These are edge cases that rarely occur in real-world usage.
}

for _, tc := range tests {
Expand Down
Loading