Re: MERGE fails to reject source references in NOT MATCHED BY SOURCE actions

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tender Wang <tndrwang(at)gmail(dot)com>
Cc: 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 09:25:00
Message-ID: CAEZATCUgW5ian1ug2+Q42Y5h3qxXK8j+Zd6wgOs2gMR4Cxgzgg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 21 Nov 2026 at 02:42, Tender Wang <tndrwang(at)gmail(dot)com> wrote:
>
> I've cc'd Dean since this issue dates back to the introduction of WHEN
> NOT MATCHED BY SOURCE.
> Dean, could you take a look at the namespace handling in v2 when you
> have a chance?

I agree that it's wrong for NOT MATCHED BY SOURCE actions to allow
access to source columns under an unaliased join. That was certainly
an oversight. It was intended to be disallowed, for consistency with
SQL-standard NOT MATCHED [BY TARGET] actions.

OTOH, it also seems pretty harmless. Fixing it risks breaking existing
queries that currently work (the Vars just return NULL, and the result
is arguably correct). So the fix would need to be flagged in the
release notes as a breaking change.

Perhaps we should just fix it in master?

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2026-11-23 09:25:55 Re: Per-table resync for logical replication subscriptions
Previous Message Jeevan Chalke 2026-11-23 09:22:51 Re: Use-after-free of a shared Path in add_path()/add_partial_path()