Skip to content

allow before insert trigger to specify missing column, but better#2883

Merged
jycor merged 5 commits intomainfrom
james/default
Mar 10, 2025
Merged

allow before insert trigger to specify missing column, but better#2883
jycor merged 5 commits intomainfrom
james/default

Conversation

@jycor
Copy link
Copy Markdown
Contributor

@jycor jycor commented Mar 9, 2025

It is possible that a BEFORE INSERT TRIGGER fills in the values for a column when it is otherwise missing. This should not trigger a missing default value error.

Fixes: dolthub/dolt#8926
This PR is an improvement on: #2876

Copy link
Copy Markdown
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just a naming/impl comment

FirstGeneratedAutoIncRowIdx int

// MissingValFlags marks which columns in the destination schema are expected to have default values.
MissingValFlags []bool
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could maybe pick a more specific name?deferredDefaults, delayedDefaults, delayedNonNulls

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd maybe make this a sql.FastIntSet also, rather than an array

@jycor jycor merged commit 5093181 into main Mar 10, 2025
8 checks passed
@jycor jycor deleted the james/default branch March 10, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: BEFORE UPDATE Trigger Not Working in Dolt

2 participants