X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 57A4A329CA4; Wed, 8 Sep 2004 18:08:25 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57932-01; Wed, 8 Sep 2004 17:08:23 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 476E7329C67; Wed, 8 Sep 2004 18:08:23 +0100 (BST) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6302550; Wed, 08 Sep 2004 10:09:40 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Andrei Bintintan" , , Subject: Re: [SQL] How to rename a constraint/trigger?? Date: Wed, 8 Sep 2004 10:05:00 -0700 User-Agent: KMail/1.4.3 References: <023201c4941a$3ade6350$0b00a8c0@forge> In-Reply-To: <023201c4941a$3ade6350$0b00a8c0@forge> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200409081005.00682.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/77 X-Sequence-Number: 14780 Andrei, > I have a database, where in the tables I have around 100 constrains (link > to other tables) that don't have a name "" or they have a name > like "$1" "$2". Now, I have a module which bases on the same structure, but > I get some query errors from a "" constraint. I really don't know > exaclty which the constrain generates the error, in that table I have 12 > such constrains. You'll be happy to know that in 7.4 we stopped using "". > Does anyone have a script or it exist a command so that I can rename all > the ""constrains in this database? You can't rename constraints, you have to drop and re-create them under a new name (do this in a transaction for data safety). However, this requires knowing what all those constraints do. I'd suggest doing a text pg_dump file of your schema only (no data) and looking in the constraints section at the end. -- Josh Berkus Aglio Database Solutions San Francisco