Re: BEFORE trigger can cause undetected partition constraint violation

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Langote <amitlangote09(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BEFORE trigger can cause undetected partition constraint violation
Date: 2017-06-02 16:56:12
Message-ID: CA+TgmoYO3iaLhjiFydauug+zzHu=q=_v8viW68=7_7sRXu_VBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 2, 2017 at 12:51 AM, Amit Langote
<Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote:
> Attached patch makes InitResultRelInfo() *always* initialize the
> partition's constraint, that is, regardless of whether insert/copy is
> through the parent or directly on the partition. I'm wondering if
> ExecInsert() and CopyFrom() should check if it actually needs to execute
> the constraint? I mean it's needed if there exists BR insert triggers
> which may change the row, but not otherwise. The patch currently does not
> implement that check.

I think it should. I mean, otherwise we're leaving a
probably-material amount of performance on the table.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-06-02 16:58:41 Re: Questions about upgrade standby with rsync
Previous Message Robert Haas 2017-06-02 16:50:16 Re: TAP: allow overriding PostgresNode in get_new_node