-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
As part of moving toward a more Postgres-compatible world where databases are isolated from each other, we're going to stop supporting references between catalog elements (i.e., tables, types, and schemas) in different databases. The following kinds of references will only be permitted for tables/types in the same database:
- foreign key constraints
- sequence ownership
- views
- user-defined types (cross-database references were never allowed, aside from a blip in the 20.2 prereleases: sql: disallow moving tables with user-defined types into a different DB #55779)
In 20.2 we introduced cluster settings to disallow creating new cross-database references for foreign keys, sequence owners, and views by default (#54126).
The proposal is that in 21.1 we'll always disallow the creation of new cross-database references, and have a mechanism to prevent upgrading to 21.2 until users have removed all their existing cross-database references by either moving tables or removing the cross-database schema elements. Specifically, we'd use the long-running migration framework, and have a potentially very long running migration that continually checks whether users have finished removing their cross-database references, and only completes successfully upon confirming that they have.
Other concerns:
- sql: renaming tables into a different parent database allows creating prohibited cross-database references #55709 needs to be fixed in general.
- sql: remove qualified name input to
ALTER TABLE ... RENAME TOafter 20.2 #51445 (removing the ability to rename tables into a different database) is somewhat related, in that we'll want to preserve a way for users to move their tables across databases to avoid cross-database references, so we probably shouldn't remove this functionality until 21.2. (Note that moving tables across databases isn't a "cross-database reference" in the sense meant by this issue.)
Epic: CRDB-1519
Jira issue: CRDB-3631