Skip to content

tableinfo: replace QuotedName with QuotedTableName, fix force-kill and test helpers#681

Merged
morgo merged 2 commits into
block:mainfrom
morgo:quoted-tablename-and-forcekill
Apr 6, 2026
Merged

tableinfo: replace QuotedName with QuotedTableName, fix force-kill and test helpers#681
morgo merged 2 commits into
block:mainfrom
morgo:quoted-tablename-and-forcekill

Conversation

@morgo
Copy link
Copy Markdown
Collaborator

@morgo morgo commented Apr 6, 2026

Three related changes to support N:M moves where connections are scoped to specific databases:

  1. TableInfo: replace QuotedName (schema.table) with QuotedTableName (table). All SQL statements now use the unqualified table name since connections are already scoped to the correct database via DSN. Updated all production code and tests.

  2. force-kill (dbconn/kill.go): use DATABASE() instead of parameterized schema name in performance_schema queries. This resolves the schema at query time from the connection, so force-kill works correctly regardless of what SchemaName is set on the TableInfo.

  3. CreateUniqueTestDatabase: now returns (string, *sql.DB) instead of just string. The returned *sql.DB is scoped to the new database, fixing tests that previously used a connection scoped to 'test' with TableInfo objects pointing to a different database.

  4. migration/runner.go: don't override LockWaitTimeout default when the Migration struct has the zero value (fixes test failures when constructing Migration{} without Kong parsing).

…d test helpers

Three related changes to support N:M moves where connections are scoped
to specific databases:

1. TableInfo: replace QuotedName (`schema`.`table`) with
   QuotedTableName (`table`). All SQL statements now use the
   unqualified table name since connections are already scoped to the
   correct database via DSN. Updated all production code and tests.

2. force-kill (dbconn/kill.go): use DATABASE() instead of parameterized
   schema name in performance_schema queries. This resolves the schema
   at query time from the connection, so force-kill works correctly
   regardless of what SchemaName is set on the TableInfo.

3. CreateUniqueTestDatabase: now returns (string, *sql.DB) instead of
   just string. The returned *sql.DB is scoped to the new database,
   fixing tests that previously used a connection scoped to 'test' with
   TableInfo objects pointing to a different database.

4. migration/runner.go: don't override LockWaitTimeout default when
   the Migration struct has the zero value (fixes test failures when
   constructing Migration{} without Kong parsing).
@morgo morgo force-pushed the quoted-tablename-and-forcekill branch from c3e7f99 to 3001db2 Compare April 6, 2026 14:41
@morgo morgo requested a review from aparajon April 6, 2026 16:09
@morgo morgo merged commit 2cb317b into block:main Apr 6, 2026
11 checks passed
@morgo morgo deleted the quoted-tablename-and-forcekill branch April 6, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants