Skip to content

[P1][bug] SHOW CREATE can run on a different pooled connection than USE #290

Closed

Description

@EVWorth

Context

DDL retrieval methods in SchemaInspector execute USE <database> and SHOW CREATE TABLE ... against the same backend but acquire pool connections independently between the two statements.

Problem

With pool_max > 1, the second statement is not guaranteed to run on the same session. If it doesn't, SHOW CREATE either fails with "no database selected" or returns DDL for the wrong default database. The intermediate USE error is also silently discarded (let _ = ...), hiding root cause.

Files

  • src-tauri/crates/mas-core/src/schema/inspector.rs:249

Repro

Set pool_max=4 on a profile. Call get_table_ddl for users 10 times in a loop. Some calls return DDL for a different DB or fail with "no database selected".

Expected

DDL retrieval works consistently regardless of pool_max; the right DB is always inspected.

Proposed fix

Scope M. Either use fully qualified escaped identifiers in SHOW CREATE TABLE \db`.`table`, or acquire one MySqlConnection, run USEandSHOW CREATEon that same connection, propagating theUSE` error.

Acceptance

DDL retrieval works at any pool size, with no error being silently dropped.

Needs human verify

Yes.

Activity

  1. added
    audit
    severity/p1
    kind/bug
    area/schema
    on Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/schemaauditkind/bugseverity/p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions