Skip to content

Table delete returns "Table not found" for a table name used in two schemas #8852

Closed

Description

@andypalmi

Summary

DELETE /api/v1/teams/:teamId/databases/:databaseId/tables/:tableName/:schemaName? takes the schema as an optional path segment. Without it, a table name that exists in more than one schema returns 404 table_not_found, although the table exists. The caller is not told that the schema is needed.

Steps to reproduce

  1. Using a Postgres tables driver, create table t in schema public and table t in schema s2.
  2. DELETE .../tables/t. It returns 404 { "code": "table_not_found", "error": "Table not found" }.
  3. DELETE .../tables/t/s2 returns 204, and DELETE .../tables/t then returns 204 too.

Expected

When the name matches more than one table, the route returns 400 (or 409) saying the name exists in several schemas and a schema must be given.

Also

The postgres-localfs driver's dropTable throws Failed to create table ... when the drop fails, so the error reads as a create failure. The supavisor driver says Failed to drop table.

Reference

  1. forge/ee/routes/tables/index.js:398-407 requires exactly one match and answers 404 otherwise.
  2. forge/ee/lib/tables/drivers/postgres-localfs.js:361, compared with postgres-supavisor.js:441.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:apiWork on the platform APItype:bugSomething isn't working

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions