Re: Inserting heap tuples in bulk in COPY - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Inserting heap tuples in bulk in COPY
Date
Msg-id 4E4588D9.6010702@enterprisedb.com
Whole thread Raw
In response to Re: Inserting heap tuples in bulk in COPY  (Florian Pflug <fgp@phlo.org>)
List pgsql-hackers
On 12.08.2011 22:57, Florian Pflug wrote:
> On Aug12, 2011, at 21:16 , Heikki Linnakangas wrote:
>> Triggers complicate this. I believe it is only safe to group tuples together like this if the table has no triggers.
ABEFORE ROW trigger might run a SELECT on the table being copied to, and check if some of the tuples we're about to
insertexist. If we run BEFORE ROW triggers for a bunch of tuples first, and only then insert them, none of the trigger
invocationswill see the other rows as inserted yet. Similarly, if we run AFTER ROW triggers after inserting a bunch of
tuples,the trigger for each of the insertions would see all the inserted rows.
 
>
> Don't we run AFTER ROW triggers after inserting *all* the tuples anyway? At least this is what we do in the case of
INSERT/UPDATE/DELETEif I'm not mistaken.
 

Um, yes, you're right. Now I feel silly. The above still applies to 
BEFORE ROW triggers, though.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: index-only scans
Next
From: Peter Eisentraut
Date:
Subject: Re: psql: bogus descriptions displayed by \d+