Re: MERGE SQL statement for PG12

From: Mi Tar <mmitar(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Subject: Re: MERGE SQL statement for PG12
Date: 2019-01-09 08:08:10
Message-ID: 154702129079.11631.12119543228296180998.pgcf@coridan.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi!

Looking at the commitfest as a novice contributor I was searching for patches to review without any reviewers set. And because I just spend some time and made a patch improving how REFRESH MATERIALIZED VIEW CONCURRENTLY works (does INSERTs/UPDATEs/DELETEs instead of just DELETEs/INSERTs) when I saw this patch I said to myself, great, MERGE is exactly what would be needed there. Because we already have a merge implementation there (requiring unique columns). I didn't know that 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 need an 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 MERGE if this is split into three separate triggers and transient relations. If we do not have a new statement-level trigger for MERGE, then this is really just a syntactic sugar on top of INSERTs, UPDATEs, and DELETEs.

Mitar

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mi Tar 2019-01-09 08:20:04 Re: additional foreign key test coverage
Previous Message Mi Tar 2019-01-09 07:40:57 Re: [PATCH] Allow UNLISTEN during recovery