Skip site navigation (1) Skip section navigation (2)

Re: Is drop/restore trigger transactional?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
Cc: Craig James <cjames(at)emolecules(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Is drop/restore trigger transactional?
Date: 2012-08-08 00:42:17
Message-ID: CAHyXU0zNGx4UR=Jnhr8pfs=W_qfeSnfLiOAMYbuAg00b7a6VTw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-performance
On Tue, Aug 7, 2012 at 5:29 PM, Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> wrote:
> On 08/08/2012 04:15 AM, Merlin Moncure wrote:
>>
>> IF current_user = 'bulk_writer' THEN
>>    return new;
>> END IF;
>> <expensive stuff>
>
> ... or re-create the trigger with a `WHEN` clause (only available in newer
> Pg versions, see CREATE TRIGGER) that excludes the migrated customer ID.
> You'd have to do it in a new tx to avoid locking the table for ages though.

yeah --- and, locking aside, I'd advise you not to do that anyways:
try and keep one block of code that enforces all the rules properly.
also, good deployment practices (especially in cases of security
sensitive environments) should have good firewalls between production
services and developer introduced code.

merlin

In response to

Responses

pgsql-performance by date

Next:From: Jeff JanesDate: 2012-08-08 00:50:32
Subject: Re: Slow query: Select all buildings that have >1 pharmacies and >1 schools within 1000m
Previous:From: Craig RingerDate: 2012-08-08 00:29:02
Subject: Re: Is drop/restore trigger transactional?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group