Re: BEFORE ROW triggers for partitioned tables - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: BEFORE ROW triggers for partitioned tables
Date
Msg-id CAExHW5sZJnAyFX2iAYC_RMv1=LGhHWbrvwqZdgkJGzc8WaASgQ@mail.gmail.com
Whole thread Raw
In response to Re: BEFORE ROW triggers for partitioned tables  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: BEFORE ROW triggers for partitioned tables
List pgsql-hackers
On Wed, Mar 11, 2020 at 8:53 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
>
> On Thu, Feb 27, 2020 at 10:22 PM Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
> >
> > * The "root" is not necessarily the root partitioned table, but instead
> > it's the table that was named in the command.  Because of this, we don't
> > need to acquire locks on the tables, since the executor already has the
> > tables open and locked (thus they cannot be modified by concurrent
> > commands).
>
> I believe this is because of the partition level constraints on the
> table that was named in the command would catch any violation in the
> partition key change in the levels above that table.
>
> Will it be easier to subject the new tuple to the partition level
> constraints themselves and report if those are violated. See
> RelationGetPartitionQual() for getting partition constraints. This
> function includes partition constraints from all the levels so in your
> function you don't have to walk up the partition tree. It includes
> constraints from the level above the table that was named in the
> command, but that might be fine. We will catch the error earlier and
> may be provide a better error message.

I realized that this will implement the third option in your original
proposal, not the second one. I suppose that's fine too?
-- 
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Berserk Autovacuum (let's save next Mandrill)
Next
From: Adé
Date:
Subject: Re: [PATCH] Fix for slow GIN index queries when "gin_fuzzy_search_limit"setting is relatively small for large tables