Re: Make a SQL statement not run trigger

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Jon Collette" <jon(at)etelos(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Make a SQL statement not run trigger
Date: 2007-08-21 22:07:29
Message-ID: dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 8/21/07, Jon Collette <jon(at)etelos(dot)com> wrote:
> Is it possible to run an insert,update, or delete and have it not launch
> a trigger like it normally would?
>
> For example could I set a value
> DONOTRUN = True;
> insert into contacts ....

The closest thing to a session variable for pgsql is going to likely
be a temp table. you could have a temp table for each session that
stores such things and the trigger looks in the temp table to see what
to do.

> Or is there just a global variable I could set to disable triggers and
> then reset it? And would that be a per connection variable?

Yes, but that would open you up to race conditions. If another
session wanted the trigger to fire it would not get it. Using a temp
table would allow you to get around the race condition.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Kellerer 2007-08-21 22:24:59 Re: Make a SQL statement not run trigger
Previous Message Jon Collette 2007-08-21 22:04:59 Re: Make a SQL statement not run trigger