sql: add assignment casts for DEFAULT and computed columns for INSERTs #74093
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.
opt: do not add empty project when no assignment casts are necessary
This commit prevents optbuilder from building empty project expressions
when no assignment casts are necessary.
It also fixes a minor bug with the scope of assignment cast projections.
Rather than pushing a new scope onto
mb.outScope
for assignment casts,it replaces
mb.outScope
with a new scope. This bug causes noobservable effect with the current assignment code-paths, but would
cause problems as more assignment cast support is added.
Release note: None
sql: add assignment casts for DEFAULT and computed columns for INSERTs
This commit adds assignment casts to INSERTS for DEFAULT and computed
column expressions when the type of the expression is not identical to
the column's type.
This change required removing
tree.ReType
fromscope.resolveAndRequireType
, which causes a regression of theupdate-col-cast-bug
test. This will be fixed in a future commit whenassignment casts are added for UPDATEs.
Release note: None