Skip to content

Commit

Permalink
Updating incremental merge where condition to handle nullable fields …
Browse files Browse the repository at this point in the history
…with an appropriate null comparison.
  • Loading branch information
amardatar committed May 11, 2023
1 parent 630cd3a commit 9e8f826
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .changes/unreleased/Fixes-20230511-142935.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Fixes
body: Fix incremental merge to use an `is null` check to allow for handling of nullable
fields in the unique_key
time: 2023-05-11T14:29:35.400734+01:00
custom:
Author: amardatar
Issue: "7597"
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@

{% if unique_key %}
{% if unique_key is sequence and unique_key is not string %}
delete from {{target }}
delete from {{ target }}
using {{ source }}
where (
{% for key in unique_key %}
{{ source }}.{{ key }} = {{ target }}.{{ key }}
{{ "and " if not loop.last}}
({{ source }}.{{ key }} = {{ target }}.{{ key }} or ({{ source }}.{{ key }} is null and {{ target }}.{{ key }} is null))
{{ "and " if not loop.last }}
{% endfor %}
{% if incremental_predicates %}
{% for predicate in incremental_predicates %}
Expand Down

0 comments on commit 9e8f826

Please sign in to comment.