Re: renaming table leaves constraint behind [7.3.2]

From: Holger Klawitter <lists(at)klawitter(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: renaming table leaves constraint behind [7.3.2]
Date: 2003-02-11 08:11:01
Message-ID: 200302110911.01513.lists@klawitter.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

thanks for your reply!

> Sure it did. The error message seems to have changed a trifle, but
> you'd get a conflict on the index name in either case.

The error message is okay. In 7.2.x the constraint was DROP INDEXed, so it
didn't show up there.

> This isn't real desirable ... but having ALTER TABLE RENAME run around
> and rename associated indexes might create issues too ...

But in particular when names are automatically created one likes a way to
change the names of the constraints. I've found a workaround:

-- as postgres --
create view my_connames as select conname from pg_constraint;
create rule upd_connames as on update to my_connames do instead
update pg_constraint
set conname = new.conname where conname = old.conname;
grant select,update on my_connames to '<user>';

With kind regards / mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter http://www.klawitter.de
lists(at)klawitter(dot)de

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Glen Eustace 2003-02-11 08:29:05 Re: Updating a table via a view
Previous Message Ben-Nes Michael 2003-02-11 07:49:19 Re: PostgreSQL x Oracle