| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
|---|---|
| To: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
| Cc: | Tender Wang <tndrwang(at)gmail(dot)com>, Joao Rito <joaovictor(dot)rito(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: MERGE fails to reject source references in NOT MATCHED BY SOURCE actions |
| Date: | 2026-11-23 10:53:24 |
| Message-ID: | awQZcYKFxUWQCsBR@alvherre.pgsql |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2026-Nov-23, Dean Rasheed wrote:
> BTW, while looking at this, I noticed that the docs for the
> "condition" expression that can appear after MERGE ... WHEN ... AND
> currently say:
>
> A condition on a WHEN MATCHED clause can refer to columns in both the
> source and the target relations. A condition on a WHEN NOT MATCHED BY
> SOURCE clause can only refer to columns from the target relation, since
> by definition there is no matching source row. A condition on a WHEN
> NOT MATCHED [BY TARGET] clause can only refer to columns from the source
> relation, since by definition there is no matching target row. Only the
> system attributes from the target table are accessible.
>
> That last sentence has existed since MERGE was added and it seems wrong to me.
>
> In fact, I find that sentence hard to interpret -- there are multiple
> possible interpretations, none of which seem to be true.
Yeah ...
> Or it could mean that system attributes from the target table are
> accessible, but system attributes from the source are not. That may
> have been true at some point during the development of the MERGE
> feature, but it's not true now -- if the source is a base table, its
> system attributes are accessible.
I think this is the correct interpretation.
> So I propose simply deleting that sentence.
+1, please do.
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"I can see support will not be a problem. 10 out of 10." (Simon Wittber)
(http://archives.postgresql.org/pgsql-general/2004-12/msg00159.php)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Virender Singla | 2026-11-23 11:19:30 | [PATCH] TRUNCATE's reset of n_live_tup/n_dead_tup is lost |
| Previous Message | Álvaro Herrera | 2026-11-23 10:46:05 | Re: MERGE fails to reject source references in NOT MATCHED BY SOURCE actions |