From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Önder Kalacı <onderkalaci(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Merge command is erroring with: PlaceHolderVar found where not expected |
Date: | 2023-03-15 14:48:21 |
Message-ID: | 3204629.1678891701@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
=?UTF-8?B?w5ZuZGVyIEthbGFjxLE=?= <onderkalaci(at)gmail(dot)com> writes:
> CREATE TABLE source (id integer, z int);
> CREATE TABLE target (id integer, z int);
> MERGE INTO public.target sda USING ((SELECT source.id, source.z, 12 AS rnd
> FROM public.source source) sdn FULL JOIN public.source sdn2 ON ((sdn.id
> OPERATOR(pg_catalog.=) sdn2.id))) ON (sda.id OPERATOR(pg_catalog.=) sdn.id)
> WHEN NOT MATCHED THEN INSERT (id, z) VALUES (sdn.id, sdn.rnd);
> *ERROR: PlaceHolderVar found where not expected*
Thanks for the report! Somebody was far too optimistic here:
* Add resjunk entries for any Vars used in each action's
* targetlist and WHEN condition that belong to relations other
* than target. Note that aggregates, window functions and
* placeholder vars are not possible anywhere in MERGE's WHEN
* clauses. (PHVs may be added later, but they don't concern us
* here.)
I'm not sure offhand whether RECURSE or INCLUDE is the more appropriate
action.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Sébastien | 2023-03-15 16:49:26 | Re: BUG #17840: Failing to execute auto_explain for logging leads to transaction rollback. |
Previous Message | Önder Kalacı | 2023-03-15 12:24:18 | Merge command is erroring with: PlaceHolderVar found where not expected |