Found while adding the create-database-table MCP tool (#8633).
The existence check filters by table name only and requires === 1, while the create runs unqualified (default schema). Tables sharing a name across schemas break the check.
Steps to reproduce
- Have table
foo in two schemas. POST create foo: the filter length is 2, not === 1, so it falls through to CREATE TABLE IF NOT EXISTS foo, which no-ops and still returns 201 (looks like a successful create).
- Have
foo only in a non-public schema. POST create foo: the filter length is 1, so it returns 409, blocking a legitimate create in the public schema.
Expected
Match on name and schema, and create in a known schema.
Reference
forge/ee/routes/tables/index.js:300-304; create is unqualified in forge/ee/lib/tables/drivers/postgres-supavisor.js:356.
Found while adding the create-database-table MCP tool (#8633).
The existence check filters by table name only and requires
=== 1, while the create runs unqualified (default schema). Tables sharing a name across schemas break the check.Steps to reproduce
fooin two schemas.POSTcreatefoo: the filter length is 2, not=== 1, so it falls through toCREATE TABLE IF NOT EXISTS foo, which no-ops and still returns 201 (looks like a successful create).fooonly in a non-public schema.POSTcreatefoo: the filter length is 1, so it returns 409, blocking a legitimate create in the public schema.Expected
Match on name and schema, and create in a known schema.
Reference
forge/ee/routes/tables/index.js:300-304; create is unqualified inforge/ee/lib/tables/drivers/postgres-supavisor.js:356.