fix: EXPOSED-602 Column name that includes table name is aliased with upserts #2287
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.
Description
Summary of the change:
Allows valid MERGE syntax to be generated again when using
upsert()
with update columns that include the table name in their name.Detailed description:
Why: PR feat: EXPOSED-436 Allow using insert values on update with upsert() #2172 changed the way update values that copy insert values are processed internally. Since then (version 0.54.0), any update-insert value is parsed like a regular expression. For dialects that use MERGE, this means the value is automatically aliased with virtual S alias and any potential presence of the table name in the update expression is also aliased with origin T. This leads to invalid identifier syntax if the expression holds a column name that itself includes the table name.
What: String replacement now only happens if the table name is located in a prefix identifier position, before '.'
Type of Change
Please mark the relevant options with an "X":
Affected databases:
Checklist
Related Issues
EXPOSED-602