-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: add setting to gate cross-db reference, default to disallow #54126
Description
Is your feature request related to a problem? Please describe.
As we move towards postgres compliance, we want to encourage the use of user-defined schemas to arrange the relations of an application. In postgres there are no cross database references or queries. In cockroach, prior to 20.2, databases and schemas were functionally equivalent. We've reached a general consensus that we'd like to move towards a world where cross-database references are not allowed. This will simplify integrity checking and backup/restore. Cross database references have also been a source of bugs and odd behavior (#51090).
Describe the solution you'd like
To move towards strict deprecation in 21.1, we'll need to announce our intention and provide some push for users to change their behavior in 20.2. The idea is that we'll create a cluster setting to disallow creating new cross-database by default and gate it behind a cluster or setting setting.
Note that databases without user-defined schema can be re-parented as schemas in other databases.
Additional context
In the 21.1 we'd like to provide a mechanism to forcibly prevent updating to 21.2 with any cross database references. If that's a goal, we need to socialize the idea early.