-
-
Notifications
You must be signed in to change notification settings - Fork 471
Description
Problem
I'll explain with an example...
-
When the user renames a table, we have client-side validation to ensure the table name does not conflict with another table name.
-
Postgres also won't allow a table to have the same name as a constraint. However we don't check to see if the user's desired table name conflicts with a constraint name because doing so would require the front end to know the names of all constraints across all tables which would require one API request per table.
-
Similarly, we don't check for conflicts with table name vs view name.
Solution
-
The front end ideally should have some way of seeing all the reserved top-level names for a given schema, so that we can provide client-side validation to ensure that user-entered names are available when the user is entering a name for a table, view, or constraint.
-
I'm open to considering different API designs to meet these needs.
-
One idea is to create a new endpoint
/api/db/v0/names. It would only acceptGETrequests and would return all the top-level names in the schema.