From: | ohp(at)pyrenet(dot)fr |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Heikki Linnakangas <heikki(at)enterprisedb(dot)com>, Rick Gigger <rick(at)alpinenetworking(dot)com>, pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: should I worry? |
Date: | 2007-11-06 19:19:42 |
Message-ID: | Pine.UW2.4.53.0711062016340.3255@sun.pyrenet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dear Tom,
On Tue, 6 Nov 2007, Tom Lane wrote:
> Date: Tue, 06 Nov 2007 10:05:58 -0500
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: ohp(at)pyrenet(dot)fr
> Cc: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>,
> Rick Gigger <rick(at)alpinenetworking(dot)com>,
> pgsql-hackers list <pgsql-hackers(at)postgresql(dot)org>
> Subject: Re: [HACKERS] should I worry?
>
> ohp(at)pyrenet(dot)fr writes:
> > IIUC, I have drop every trigger like this :
>
> > SELECT t.tgname, c.relname, tgconstrname FROM pg_trigger t, pg_class c
> > WHERE t.tgrelid = c.oid AND tgname like 'RI_ConstraintTrigger_%'AND
> > tgconstrname = '<unnamed>';
>
> > and I delete all those ancient foreign key WITHOUT disturbing any others
> > Is that right?
>
> Not necessarily --- are you sure you don't have any real constraints
> named "<unnamed>"?
>
yes
> However, if you do, the DROP TRIGGER command will just fail, so maybe
> you don't need to bother with looking into pg_depend for yourself.
>
> regards, tom lane
>
Thanks to your last sentence, I ended up with the rather crude script
below that works for me (expect a lot of errors)
DBNAME=xxx
for s in `psql -t ${DBNAME} << EOD
SELECT 'DROP TRIGGER "' || t.tgname || '" ON ' || c.relname || ';'
FROM pg_trigger t, pg_class c
WHERE t.tgrelid = c.oid AND tgname like 'RI_ConstraintTrigger_%'
EOD`
do
echo $s
done|psql ${DBNAME}
Could maybe help others like me....
What's your opinion?
--
Olivier PRENANT Tel: +33-5-61-50-97-00 (Work)
15, Chemin des Monges +33-5-61-50-97-01 (Fax)
31190 AUTERIVE +33-6-07-63-80-64 (GSM)
FRANCE Email: ohp(at)pyrenet(dot)fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2007-11-06 19:42:23 | EquivalenceClasses vs volatile functions |
Previous Message | Stefan Kaltenbrunner | 2007-11-06 18:33:11 | tribble.postgresql.org - planned maintenance downtime |