Re: Supporting MERGE on updatable views

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Supporting MERGE on updatable views
Date: 2024-01-30 11:58:21
Message-ID: 202401301158.twczkojapiun@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024-Jan-29, Dean Rasheed wrote:

> Yeah, for all practical purposes, that check in CheckValidResultRel()
> has been dead code since d751ba5235, but I think it's still worth
> doing, and if we're going to do it, we should do it properly. I don't
> like using elog() in some cases and ereport() in others, but I also
> don't like having that much duplicated code between this and the
> rewriter (and this patch doubles the size of that block).
>
> A neater solution is to export the rewriter functions and use them in
> CheckValidResultRel(). All these checks can then be reduced to
>
> if (!view_has_instead_trigger(...))
> error_view_not_updatable(...)
>
> which eliminates a lot of duplicated code and means that we now have
> just one place that throws these errors.

This looks quite nice, thanks. LGTM.

--
Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/
"No me acuerdo, pero no es cierto. No es cierto, y si fuera cierto,
no me acuerdo." (Augusto Pinochet a una corte de justicia)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-01-30 12:16:36 Re: Question on LWLockMode in dsa.c
Previous Message Zhijie Hou (Fujitsu) 2024-01-30 11:52:17 RE: Race condition in FetchTableStates() breaks synchronization of subscription tables