Re: "drop constraint trigger" on PostgreSQL

From: Kyle <kyle(at)actarg(dot)com>
To: Bryan Field-Elliot <bryan(at)netmeme(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: "drop constraint trigger" on PostgreSQL
Date: 2000-12-08 23:35:21
Message-ID: 3A317038.CBE9B378@actarg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
kyle.vcf text/x-vcard 185 bytes

Browse pgsql-sql by date

  From Date Subject
Next Message feblec 2000-12-09 08:16:06 plpgsql
Previous Message Joel Burton 2000-12-08 23:12:28 Re: How to...