pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Jon Collette <jon@etelos.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Make a SQL statement not run trigger
Date: Tue, 21 Aug 2007 17:07:29 -0500
Message-ID: <dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com> (raw)
In-Reply-To: <46CB5876.80003@etelos.com>
References: <46CB5876.80003@etelos.com>

On 8/21/07, Jon Collette <jon@etelos.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.



view thread (8+ messages)  latest in thread

Message-ID: <dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com>
Permalink:  ../dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: scott.marlowe@gmail.com, jon@etelos.com
  Subject: Re: Make a SQL statement not run trigger
  In-Reply-To: <dcc563d10708211507r351a46efxc758168f6032ab3f@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox