Reporting a bug with the new MERGE statement. Tested against 75edb919613ee835e7680e40137e494c7856bcf9.
psql output as follows:
... psql:merge.sql:33: ERROR: variable not found in subplan target lists ROLLBACK [local] joe@joe=# \errverbose ERROR: XX000: variable not found in subplan target lists LOCATION: fix_join_expr_mutator, setrefs.c:2800
CREATE TABLE source (order_id, item_id, quantity, price) AS (SELECT order_id, item_id, incoming.quantity, incoming.price FROM item LEFT JOIN incoming USING (order_id, item_id));
MERGE INTO item a USING source b ON (a.order_id, a.item_id) = (b.order_id, b.item_id) WHEN NOT MATCHED THEN INSERT (order_id, item_id, quantity, price) VALUES (order_id, item_id, quantity, price) WHEN MATCHED AND a.* IS DISTINCT FROM b.* THEN UPDATE SET (quantity, price) = (b.quantity, b.price) WHEN MATCHED AND (b.quantity IS NULL AND b.price IS NULL) THEN DELETE; COMMIT;
It seems related to the use of a.* and b.*
Sorry I can't be more specific. Error manifests when planning occurs and that is well outside of my code base knowledge.
Hope this helps.
Cheers, -Joe
Hi,
It seems all the calls to fix_join_expr_mutator() are within setrefs.c
I haven't found where in nodeFuncs.c fix_join_expr_mutator is called.
I am on commit 75edb919613ee835e7680e40137e494c7856bcf9 .