-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: renaming tables into a different parent database allows creating prohibited cross-database references #55709
Comments
This is also broken for type references and sequence owner references (gated by
Fortunately, for now we don't allow renaming tables that are referred to by views. I'm worried about cross-db type references the most, since they're supposed to be disallowed from the start, and now we'll have to account for them during whatever migration we have coming up. |
sql.cross_db_fks.enabled
does not prevent cross-db foreign key relations
Linking to #54126 as the original issue. |
Linking to #55709 |
55459: kv: increase defaultRaftLogTruncationThreshold to 16MB r=nvanbenschoten a=nvanbenschoten In v20.1, we increased the default max range size from 64MB to 512MB. However, we only doubled (258b965) the default raft log truncation threshold. This has the potential to exacerbate issues like #37906, because each range will now handle on average 8 times more write load, and will therefore be forced to truncate its log on average 4 times as frequently as it had previously. This commit bumps the default raft log truncation to 16MB. It doesn't go as far as scaling the log truncation threshold by the max range size (either automatically or with a fixed 32MB default) because the cost of an individual log truncation is proportional to the log size and we don't want to make each log truncation significantly more disruptive. 16MB seems like a good middle ground and we know that we have customers already successfully running in production with this value. 55660: sql: add constraint name to constraint error r=yuzefovich a=alex-berger Add constraint name to error for unique constraint, check constraintand foreign key constraint violations. Those constraint names are then propagated over the PostgreSQL wire protocol and will show up for example in JDBC exceptions (org.postgresql.util.PSQLException#getServerErrorMessage().getConstraint()). This commit improves PostgreSQL compatibility. Release note: Improve PosgreSQL wire protocol compatibility by adding constraint name to sql errors. 55759: roachtest: don't expect node deaths in tpccbench r=nvanbenschoten a=nvanbenschoten Closes #55542. This was causing node deaths to be initially ignored in test failures like #55542. The monitor was not watching when the cluster was restarted, so there was no need to inform it of the restart. Because of this, the monitor had an accumulated "death quota" that allowed it to ignore the first few deaths during the actual run of the test. I tested this 5 times without issue. 55779: sql: disallow moving tables with user-defined types into a different DB r=lucy-zhang a=lucy-zhang We disallow columns using user-defined types in a different database from the table at creation time. However, we have a loophole where it's possible to move the table to a different database using `RENAME` and thus create a cross-database reference. This breaks backup/restore and is generally unintended. This PR adds a check to disallow this. Partially addresses #55709. Related to #55772. Release note (bug fix): Tables can no longer be moved to a different database using `RENAME` if they have columns using user-defined types (enums). Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com> Co-authored-by: alex.berger@nexiot.ch <alex.berger@nexiot.ch> Co-authored-by: Lucy Zhang <lucy@cockroachlabs.com>
Fixes: cockroachdb#55709 Previously, disallowed cross DB references could be created using a ALTER TABLE/VIEW/SEQUENCE rename operations. This was inadequate because users could accidentally start using deprecated functionality. To address this, this patch detects such scenarios are returns an appropriate error. Release note (bug fix): ALTER TABLE/VIEW/SEQUENCE can no longer be used to incorrectly create cross DB references. Release justification: Low risk fix to avoid users from accidentally, using deprecated functionality.
Fixes: cockroachdb#55709 Previously, disallowed cross DB references could be created using a ALTER TABLE/VIEW/SEQUENCE rename operations. This was inadequate because users could accidentally start using deprecated functionality. To address this, this patch detects such scenarios are returns an appropriate error. Release note (bug fix): ALTER TABLE/VIEW/SEQUENCE can no longer be used to incorrectly create cross DB references. Release justification: Low risk fix to avoid users from accidentally, using deprecated functionality.
61741: sql: disallow table/view/sequence rename from making cross DB references r=fqazi a=fqazi Fixes: #55709 Previously, disallowed cross DB references could be created using a ALTER TABLE/VIEW/SEQUENCE rename operations. This was inadequate because users could accidentally start using deprecated functionality. To address this, this patch detects such scenarios are returns an appropriate error. Release note (bug fix): ALTER TABLE/VIEW/SEQUENCE can no longer be used to incorrectly create cross DB references. Co-authored-by: Faizan Qazi <faizan@cockroachlabs.com>
Fixes: cockroachdb#55709 Previously, disallowed cross DB references could be created using a ALTER TABLE/VIEW/SEQUENCE rename operations. This was inadequate because users could accidentally start using deprecated functionality. To address this, this patch detects such scenarios are returns an appropriate error. Release note (bug fix): ALTER TABLE/VIEW/SEQUENCE can no longer be used to incorrectly create cross DB references. Release justification: Low risk fix to avoid users from accidentally, using deprecated functionality.
Describe the problem
Even with
sql.cross_db_fks.enabled=false
, one can move a table to another database such that there is a cross-database foreign key relation.To Reproduce
Expected behavior
This should only work if
sql.cross_db_fks.enabled
is set totrue
.Environment:
Epic: CRDB-1519
The text was updated successfully, but these errors were encountered: