From: Josh Berkus <josh@agliodbs.com>
To: Andrei Bintintan <klodoma@ar-sd.net>
To: pgsql-sql@postgresql.org
To: pgsql-admin@postgresql.org
Subject: Re: [SQL] How to rename a constraint/trigger??
Date: Wed, 8 Sep 2004 10:05:00 -0700
Message-ID: <200409081005.00682.josh@agliodbs.com> (raw)
In-Reply-To: <023201c4941a$3ade6350$0b00a8c0@forge>
References: <023201c4941a$3ade6350$0b00a8c0@forge>
Andrei,
> I have a database, where in the tables I have around 100 constrains (link
> to other tables) that don't have a name "<unnamed>" 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 "<unnamed>" 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 "<unnamed>".
> Does anyone have a script or it exist a command so that I can rename all
> the "<unnamed>"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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, klodoma@ar-sd.net, pgsql-admin@postgresql.org
Subject: Re: [SQL] How to rename a constraint/trigger??
In-Reply-To: <200409081005.00682.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox