-
Notifications
You must be signed in to change notification settings - Fork 466
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
ON UPDATE expressions #12035
ON UPDATE expressions #12035
Conversation
✔️ Netlify Preview 🔨 Explore the source changes: 4da219e 🔍 Inspect the deploy log: https://app.netlify.com/sites/cockroachdb-docs/deploys/61827552846a1b000851a002 😎 Browse the preview: https://deploy-preview-12035--cockroachdb-docs.netlify.app/docs/v21.2/add-column |
@mgartner Adding you for eng review, as original author of cockroachdb/cockroach#69091 is no longer with us. Feel free to request a reassign! |
one thought: in the computed columns page, we should also mention that computed columns are mutually exclusive with https://www.cockroachlabs.com/docs/stable/computed-columns.html#considerations |
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples looks great! just had comments about how DEFAULT and ON UPDATE should probably be categorized the same as each other
v21.2/computed-columns.md
Outdated
@@ -21,7 +21,7 @@ Computed columns: | |||
- Cannot be used to generate other computed columns. | |||
- Cannot reference a [foreign key](foreign-key.html). | |||
- Behave like any other column, with the exception that they cannot be written to directly. | |||
- Are mutually exclusive with [`DEFAULT`](default-value.html). | |||
- Are mutually exclusive with [`DEFAULT` constraints](default-value.html) and [`ON UPDATE` expressions](add-column.html#on-update-expressions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: DEFAULT
isn't really a "constraint" -- maybe say DEFAULT
expressions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or DEFAULT
qualifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT isn't really a "constraint"
Hmm... we document DEFAULT
as a column constraint all over our docs (see the Default Value Constraint and Constraints pages).
I've updated this particular instance to use "DEFAULT
expressions", but, if you think the other docs are incorrect/misleading, I can file a new issue to update how we document DEFAULT
in a separate PR. Maybe we just fold the entire "Default Value Constraint" page into a subsection of ADD COLUMN
(like we've done here with ON UPDATE
).
- [Column-level constraints](constraints.html) | ||
- [Collations](collate.html) | ||
- [Column family assignments](column-families.html) | ||
- <span class="version-tag">New in v21.2</span>: [`ON UPDATE` expressions](#on-update-expressions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to my other comment, i don't thing DEFAULT
should be included under constraints. instead, DEFAULT
should be documented as basically identically to ON UPDATE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
(but see my comment below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR!
v21.2/computed-columns.md
Outdated
@@ -21,7 +21,7 @@ Computed columns: | |||
- Cannot be used to generate other computed columns. | |||
- Cannot reference a [foreign key](foreign-key.html). | |||
- Behave like any other column, with the exception that they cannot be written to directly. | |||
- Are mutually exclusive with [`DEFAULT`](default-value.html). | |||
- Are mutually exclusive with [`DEFAULT` constraints](default-value.html) and [`ON UPDATE` expressions](add-column.html#on-update-expressions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT isn't really a "constraint"
Hmm... we document DEFAULT
as a column constraint all over our docs (see the Default Value Constraint and Constraints pages).
I've updated this particular instance to use "DEFAULT
expressions", but, if you think the other docs are incorrect/misleading, I can file a new issue to update how we document DEFAULT
in a separate PR. Maybe we just fold the entire "Default Value Constraint" page into a subsection of ADD COLUMN
(like we've done here with ON UPDATE
).
v21.2/add-column.md
Outdated
Note the following limitations of `ON UPDATE` expressions: | ||
|
||
- You cannot add a [foreign key constraint](foreign-key.html) and an `ON UPDATE` expression to the same column. | ||
- Values populated by [`DEFAULT` constraints](default-value.html) do not trigger an `ON UPDATE` change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Values populated by
DEFAULT
constraints do not trigger anON UPDATE
change.
Updated this line
- [Column-level constraints](constraints.html) | ||
- [Collations](collate.html) | ||
- [Column family assignments](column-families.html) | ||
- <span class="version-tag">New in v21.2</span>: [`ON UPDATE` expressions](#on-update-expressions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
(but see my comment below)
This looks great! My only note is that ON UPDATE expressions have some behavior regarding when they execute that might be surprising if coming from MySQL ON UPDATE. Probably worth documenting: It also may be worth noting that ON UPDATE expressions are closest to DEFAULT in terms of what kinds of expressions they allow (they allow context-dependent expressions but not expressions that reference other columns). For ex. |
Thanks for taking the time to look over this! I've rewritten the "ON UPDATE expressions" section, following your feedback. I am a bit uncertain about the |
@ericharmeling LGTM! |
v21.2/add-column.md
Outdated
- [`DEFAULT` expressions](default-value.html) | ||
- <span class="version-tag">New in v21.2</span>: [`ON UPDATE` expressions](#on-update-expressions) | ||
|
||
### ON UPDATE expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### ON UPDATE expressions | |
### `ON UPDATE` expressions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See suggestion for formatting in heading.
Fixes #11441.
Related to #11028.