X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 28C569DCB3D for ; Wed, 7 Dec 2005 19:43:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 17003-04 for ; Wed, 7 Dec 2005 19:43:23 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail48.e.nsc.no (mail48.e.nsc.no [193.213.115.48]) by postgresql.org (Postfix) with ESMTP id BACA09DCB4D for ; Wed, 7 Dec 2005 19:43:18 -0400 (AST) Received: from [192.168.0.57] (062016183238.customer.alfanett.no [62.16.183.238]) (authenticated bits=0) by mail48.nsc.no (8.13.5/8.13.5) with ESMTP id jB7NhIe9029402 for ; Thu, 8 Dec 2005 00:43:20 +0100 (CET) From: "Leif B. Kristensen" To: pgsql-sql@postgresql.org Subject: Re: Error from trigger Date: Thu, 8 Dec 2005 00:43:18 +0100 User-Agent: KMail/1.8.1 References: <200512080006.44606.leif@solumslekt.org> <4507.1133997785@sss.pgh.pa.us> In-Reply-To: <4507.1133997785@sss.pgh.pa.us> X-Face: %iea8o"[SI'kMDS.`hz7lU=?\^lC9J-]CVjo; f{4-C:$?uVUEjyN~uYFn%*aH_c3d09U>=?utf-8?q?x=0A=09TXtaoj=7EMV=2E8PgG7hik9=3BcCT2N6+u?=@Y{wH\p3*_f~FH9k,Wi74e[_l%.7b^'zJ)8S'^G<(=?utf-8?q?=3D=0A=09zw8=5CPMC3=27=7BKl9=2EzL*ks!b6wA?=,c~'F`k&Vq|ELDGa|4 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/63 X-Sequence-Number: 23605 On Thursday 08 December 2005 00:23, Tom Lane wrote: >Is there a reason you don't just mark the FK reference as ON DELETE >CASCADE, rather than using a handwritten trigger? I could have done that, of course. I'm still a little shaky on "best=20 practice" with these things. Besides, I haven't found out yet how to=20 alter the table to make the reference cascading. And I wanted to=20 experiment with simple triggers. >Offhand this looks like you might have dropped and recreated the >event_citations table? If so it's just the known problem that >plpgsql caches plans and doesn't throw them away when the referenced >objects change. Right on target. Thank you. A few days ago, as I have already related on=20 this list, I did the following to fix a bad design with inherited=20 tables: pgslekt=3D> create table event_cits ( pgslekt(> event_fk integer references events (event_id), pgslekt(> source_fk integer references sources (source_id), pgslekt(> PRIMARY KEY (event_fk, source_fk) pgslekt(> ); NOTICE: =A0CREATE TABLE / PRIMARY KEY will create implicit index=20 "event_cits_pkey" for table "event_cits" CREATE TABLE pgslekt=3D> insert into event_cits (select event_fk, source_fk from=20 event_citations); INSERT 0 29139 pgslekt=3D> drop table event_citations cascade; NOTICE: =A0drop cascades to rule _RETURN on view event_notes NOTICE: =A0drop cascades to view event_notes DROP TABLE pgslekt=3D> drop table citations; DROP TABLE pgslekt=3D> alter table event_cits rename to event_citations; ALTER TABLE pgslekt=3D> \i views_and_functions.sql I've run a VACUUM FULL ANALYZE, but that doesn't seem to cure the=20 situation. Is there a way to fix it, short of a full dump, drop, and =20 reload? =2D-=20 Leif Biberg Kristensen | Registered Linux User #338009 http://solumslekt.org/ | Cruising with Gentoo/KDE