fix: INSERT.from(SELECT) used non-existent value #1565
Open
patricebender wants to merge 7 commits into
Open
Conversation
…`value` column `managed_default` unconditionally emitted `json_type(value, ...)` to check whether a column value was provided. This only works in `json_each()` contexts used by `INSERT.entries()`/`INSERT.rows()`. For `INSERT.from(SELECT)`, there is no `json_each()` — the source is a subquery aliased as `NEW`. Now `managed_default` checks the INSERT context: for `INSERT.from(SELECT)`, it uses `src IS NULL` instead of `json_type(value, ...)`. Closes #1559
5eb83d4 to
19e1bbd
Compare
…`value` column `managed_default` unconditionally emitted `json_type(value, ...)` to check whether a column value was provided. This only works in `json_each()` contexts used by `INSERT.entries()`/`INSERT.rows()`. For `INSERT.from(SELECT)`, there is no `json_each()` — the source is a subquery aliased as `NEW`. For columns not provided by the SELECT (added via `requiredColumns`), the managed default is now applied directly. Columns that are in the SELECT pass through verbatim — NULL is a valid provided value and must not be overridden. Closes #1559
Member
Author
|
@BobdenOs is this PR ready? |
Contributor
|
@patricebender it is ready, but it now requires an additional reviewer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
referencing undefined
valuecolumnmanaged_defaultunconditionally emittedjson_type(value, ...)to check whether a column value was provided. This only works injson_each()contexts used byINSERT.entries()/INSERT.rows(). ForINSERT.from(SELECT), there is nojson_each()because the source is a subquery aliased asNEW.Now
managed_defaultchecks the INSERT context: forINSERT.from(SELECT), it usessrc IS NULLinstead ofjson_type(value, ...).Closes #1559