Re: MERGE SQL statement for PG12 - Mailing list pgsql-hackers

From Mi Tar
Subject Re: MERGE SQL statement for PG12
Date
Msg-id 154702129079.11631.12119543228296180998.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: MERGE SQL statement for PG12  (Pavan Deolasee <pavan.deolasee@gmail.com>)
List pgsql-hackers
Hi!

Looking at the commitfest as a novice contributor I was searching for patches to review without any reviewers set. And
becauseI just spend some time and made a patch improving how REFRESH MATERIALIZED VIEW CONCURRENTLY works (does
INSERTs/UPDATEs/DELETEsinstead of just DELETEs/INSERTs) when I saw this patch I said to myself, great, MERGE is exactly
whatwould be needed there. Because we already have a merge implementation there (requiring unique columns). I didn't
knowthat I will discover such a long and beautiful thread.
 

So I will just add my 2c based on experience from REFRESH MATERIALIZED VIEW CONCURRENTLY work. I think that we would
needan additional statement-level trigger for MERGE, instead of it being exposed as INSERT, UPDATE, and DELETE
triggers.Because it is really tricky to make triggers work if you want to know how exactly the table as changed through
MERGEif this is split into three separate triggers and transient relations. If we do not have a new statement-level
triggerfor MERGE, then this is really just a syntactic sugar on top of INSERTs, UPDATEs, and DELETEs.
 


Mitar

pgsql-hackers by date:

Previous
From: Mi Tar
Date:
Subject: Re: [PATCH] Allow UNLISTEN during recovery
Next
From: Mi Tar
Date:
Subject: Re: additional foreign key test coverage