pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
disabling triggers temporaly
2+ messages / 2 participants
[nested] [flat]

* disabling triggers temporaly
@ 2006-06-02 04:54 Mario Medina <mario@soweb.com.mx>
  2006-06-04 14:15 ` Re: disabling triggers temporaly Robert Treat <xzilla@users.sourceforge.net>
  0 siblings, 1 reply; 2+ messages in thread

From: Mario Medina @ 2006-06-02 04:54 UTC (permalink / raw)
  To: pgsql-php

Hi! does it exists any way to make that a trigger be disabled only for 
one insert and for other inserts not?

I have a table, every insert,update or delete on it activates a trigger 
that do some tasks, but i wish that when i call special 
insert/update/delete on that table the trigger doesn't starts...

The only way i think to do that is to start a transaction, delete the 
trigger, do the insert on the table, create the trigger again an commit 
the transaction..., and another is to make the trigger to check some 
value, and if that value is 1 the trigger works, if it is 0 the trigger 
doesn't, but i wish to know if it is a better way.

Thank you.






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: disabling triggers temporaly
  2006-06-02 04:54 disabling triggers temporaly Mario Medina <mario@soweb.com.mx>
@ 2006-06-04 14:15 ` Robert Treat <xzilla@users.sourceforge.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Robert Treat @ 2006-06-04 14:15 UTC (permalink / raw)
  To: pgsql-php; +Cc: Mario Medina <mario@soweb.com.mx>

On Friday 02 June 2006 00:54, Mario Medina wrote:
> Hi! does it exists any way to make that a trigger be disabled only for
> one insert and for other inserts not?
>
> I have a table, every insert,update or delete on it activates a trigger
> that do some tasks, but i wish that when i call special
> insert/update/delete on that table the trigger doesn't starts...
>
> The only way i think to do that is to start a transaction, delete the
> trigger, do the insert on the table, create the trigger again an commit
> the transaction..., and another is to make the trigger to check some
> value, and if that value is 1 the trigger works, if it is 0 the trigger
> doesn't, but i wish to know if it is a better way.
>

You can do this with alter table... see 
http://www.postgresql.org/docs/8.1/interactive/sql-altertable.html

-- 
Robert Treat
Build A Brighter Lamp :: http://www.brighterlamp.org



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2006-06-04 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-06-02 04:54 disabling triggers temporaly Mario Medina <mario@soweb.com.mx>
2006-06-04 14:15 ` Robert Treat <xzilla@users.sourceforge.net>

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