-
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
Ability to enable multiple modification subqueries of same table per client session #76261
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
O-community
Originated from the community
T-sql-queries
SQL Queries Team
X-blathers-triaged
blathers was able to find an owner
Comments
dimpavloff
added
the
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
label
Feb 8, 2022
blathers-crl
bot
added
O-community
Originated from the community
X-blathers-triaged
blathers was able to find an owner
labels
Feb 8, 2022
Hi @dimpavloff, this is a good point. I think we were hoping to have a fix to #70731 sooner, but obviously it hasn't happened yet. Let me see what I can do. |
michae2
added a commit
to michae2/cockroach
that referenced
this issue
Apr 8, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: cockroachdb#76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible.
michae2
added a commit
to michae2/cockroach
that referenced
this issue
Apr 13, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: cockroachdb#76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible.
blathers-crl bot
pushed a commit
that referenced
this issue
Apr 13, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: #76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible.
Thanks! |
michae2
added a commit
that referenced
this issue
May 4, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: #76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible. Release justification: low risk, high benefit change to existing functionality.
michae2
added a commit
to michae2/cockroach
that referenced
this issue
May 6, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: cockroachdb#76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible. Release justification: low risk, high benefit change to existing functionality.
michae2
added a commit
that referenced
this issue
May 10, 2022
Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of sql.multiple_modifications_of_table.enabled to allow execution of statements with multiple modification subqueries of the same table. Instead of making the original cluster setting the GlobalDefault of this new session setting, the original cluster setting is kept in the optbuilder logic. This is to avoid breaking applications that are already toggling the cluster setting mid-session to allow statements. Fixes: #76261 Release note (sql change): Add a new session variable, enable_multiple_modifications_of_table, which can be used instead of cluster variable sql.multiple_modifications_of_table.enabled to allow statements containing multiple INSERT ON CONFLICT, UPSERT, UPDATE, or DELETE subqueries modifying the same table. Note that underlying issue 70731 is not fixed. As with sql.multiple_modifications_of_table.enabled, be warned that with this session variable enabled there is nothing to prevent the table corruption seen in issue 70731 from occuring if the same row is modified multiple times by different subqueries of a single statment. It's best to rewrite these statements, but the session variable is provided as an aid if this is not possible. Release justification: low risk, high benefit change to existing functionality.
This was referenced Jun 13, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
O-community
Originated from the community
T-sql-queries
SQL Queries Team
X-blathers-triaged
blathers was able to find an owner
Is your feature request related to a problem? Please describe.
To mitigate the risks of #70731, #70976 disabled having multiple subquery modifications on the same table in the same transaction and created the
sql.multiple_modifications_of_table.enabled
cluster setting to re-enable it.Having it as a cluster setting feels too broad, however. A cluster admin may be forced to enable it for an important query if it is safe to run. However, subsequent new queries may hit the problems of #70731 without anyone noticing.
Describe the solution you'd like
It would be better if
sql.multiple_modifications_of_table.enabled
can be toggled as a session variable. This allows to locally reason about particular queries.Jira issue: CRDB-13051
The text was updated successfully, but these errors were encountered: