Re: "drop constraint trigger" on PostgreSQL - Mailing list pgsql-sql

From Kyle
Subject Re: "drop constraint trigger" on PostgreSQL
Date
Msg-id 3A317038.CBE9B378@actarg.com
Whole thread Raw
List pgsql-sql
Bryan Field-Elliot wrote:
Searching the archives, it seems you once tried to find out how to "drop constraint trigger" on PostgreSQL; did you ever figure it out? Thank you,Bryan


I wrote the following function and installed it in my database.  I can then call it with a select (yuk) to drop a constraint trigger:

-- Drop all constraint triggers with a given constraint name
-- calling sequence: drop_contrig(constrname)
create function drop_contrig(text) returns text as '
    set d(tgname) {}
    spi_exec -array d "select c.relname,t.tgname from pg_class c, pg_trigger t where c.oid = t.tgrelid and tgconstrname = \'$1\'" {
        spi_exec "drop trigger \\"$d(tgname)\\" on $d(relname)"
    }
    if {$d(tgname) == {}} {return "No constraint trigger $1 found"}
    return "Drop trigger $d(tgname) on $d(relname)"
    ' LANGUAGE 'pltcl';
 
 

Attachment

pgsql-sql by date:

Previous
From: "W. van den Akker"
Date:
Subject: How to...
Next
From: Bruce Momjian
Date:
Subject: Re: trying to pattern match to a value contained in a column