Received: from lists.unixathome.org (lists.unixathome.org [210.48.103.158]) by postgresql.org (Postfix) with ESMTP id 17762475972 for ; Sat, 2 Mar 2002 16:42:44 -0500 (EST) Received: from wocker (lists.unixathome.org [210.48.103.158]) by lists.unixathome.org (8.11.6/8.11.6) with ESMTP id g22LgWk55334; Sun, 3 Mar 2002 10:42:37 +1300 (NZDT) (envelope-from dan@lists.unixathome.org) Message-Id: <200203022142.g22LgWk55334@lists.unixathome.org> From: "Dan Langille" Organization: DVL Software Limited To: Stephan Szabo Date: Sat, 2 Mar 2002 16:42:29 -0500 MIME-Version: 1.0 Subject: Re: removing duplicated constraints Reply-To: dan@langille.org Cc: References: <200203021749.g22HnDk53558@lists.unixathome.org> In-reply-to: <20020302110754.K52221-100000@megazone23.bigpanda.com> X-mailer: Pegasus Mail for Windows (v4.01) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Archive-Number: 200203/27 X-Sequence-Number: 3562 On 2 Mar 2002 at 11:09, Stephan Szabo wrote: > On Sat, 2 Mar 2002, Dan Langille wrote: > > > On 2 Mar 2002 at 10:19, Dan Langille wrote: > > > > > CREATE CONSTRAINT TRIGGER "" AFTER INSERT OR UPDATE ON "ports" > > > FROM "categories" NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW > > > EXECUTE PROCEDURE "RI_FKey_check_ins" ('', 'ports', > > > 'categories', 'UNSPECIFIED', 'category_id', 'id'); > > > > > > CREATE CONSTRAINT TRIGGER "" AFTER INSERT OR UPDATE ON "ports" > > > FROM "categories" NOT DEFERRABLE INITIALLY IMMEDIATE FOR EACH ROW > > > EXECUTE PROCEDURE "RI_FKey_check_ins" ('', 'ports', > > > 'categories', 'UNSPECIFIED', 'category_id', 'id'); > > > > How is an unnamed trigger deleted? During a dump, I can find information > > such as this: > > The "" is the constraint name given. It also gets a trigger name > (see system table pg_trigger) which you can use with DROP TRIGGER (although > in the case of the fk constraint triggers you need to double quote the > name). I found the list of duplicate constraints by eyeballing the files I created using the methods mentioned in previous post (mainly grep and sort). Then I would search in the original dump file for the the CREATE CONSTRAINT statement. Using the name found there (RI_ConstraintTrigger_998199), I did this: drop TRIGGER "RI_ConstraintTrigger_998189" on categories; Making sense? -- Dan Langille The FreeBSD Diary - http://freebsddiary.org/ - practical examples