-
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: incorrect handling for computed columns in row-level BEFORE triggers #132979
Labels
A-sql-trigger
Triggers and Trigger Functions
backport-24.3.x
Flags PRs that need to be backported to 24.3
branch-master
Failures and bugs on the master branch.
branch-release-24.3
Used to mark GA and release blockers, technical advisories, and bugs for 24.3
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-queries
SQL Queries Team
Comments
DrewKimball
added
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
branch-master
Failures and bugs on the master branch.
T-sql-queries
SQL Queries Team
A-sql-trigger
Triggers and Trigger Functions
backport-24.3.x
Flags PRs that need to be backported to 24.3
labels
Oct 19, 2024
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Oct 24, 2024
This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes cockroachdb#132979 Release note: None
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Nov 4, 2024
This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes cockroachdb#132979 Release note: None
craig bot
pushed a commit
that referenced
this issue
Nov 6, 2024
133328: sql: fix trigger interaction with computed columns r=DrewKimball a=DrewKimball This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes #132979 Release note: None 134313: opt: make `max-stack` opt tester option more reliable r=mgartner a=mgartner The `max-stack` opt tester option now runs the test command in a separate goroutine. A fresh stack makes tests using this setting more reliable. It also decreases the `max-stack` of the original test that motivated the `max-stack` option (see #132701) to 100KB, between 65KB in which the test fails after the fix in #132701 and 135KB in which the test fails before the fix. Finally, the test has been disabled under `race` builds which increase the size of stack frames and would cause this test to fail. Epic: None Release note: None Co-authored-by: Drew Kimball <drewk@cockroachlabs.com> Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Nov 6, 2024
This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes cockroachdb#132979 Release note: None
craig bot
pushed a commit
that referenced
this issue
Nov 6, 2024
133328: sql: fix trigger interaction with computed columns r=mgartner a=DrewKimball This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes #132979 Release note: None Co-authored-by: Drew Kimball <drewk@cockroachlabs.com>
Based on the specified backports for linked PR #133328, I applied the following new label(s) to this issue: branch-release-24.3. Please adjust the labels as needed to match the branches actually affected by this issue, including adding any known older branches. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
blathers-crl
bot
added
the
branch-release-24.3
Used to mark GA and release blockers, technical advisories, and bugs for 24.3
label
Nov 6, 2024
DrewKimball
added a commit
to DrewKimball/cockroach
that referenced
this issue
Nov 7, 2024
This commit makes the following changes to the way row-level BEFORE triggers interact with computed columns: * BEFORE triggers now observe NULL values in place of computed columns. * Modifications to computed columns by BEFORE triggers are ignored. * Computed columns are re-computed after row-level BEFORE triggers execute. These changes make the behavior consistent with that of Postgres. Fixes cockroachdb#132979 Release note: None
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-sql-trigger
Triggers and Trigger Functions
backport-24.3.x
Flags PRs that need to be backported to 24.3
branch-master
Failures and bugs on the master branch.
branch-release-24.3
Used to mark GA and release blockers, technical advisories, and bugs for 24.3
C-bug
Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
T-sql-queries
SQL Queries Team
Currently, row-level BEFORE triggers are projected after computed columns. This means that the trigger will be able to "see" and directly modify the computed values, and that modifications made by the trigger won't be visible in the computed column.
Contrast this with Postgres:
Example with direct modification of the computed column.
Example with modification of a referenced column.
Jira issue: CRDB-43620
The text was updated successfully, but these errors were encountered: