Re: Index name different from constraint name - Mailing list pgsql-bugs

From Stephen Frost
Subject Re: Index name different from constraint name
Date
Msg-id 20051026161457.GU6026@ns.snowman.net
Whole thread Raw
In response to Re: Index name different from constraint name  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Index name different from constraint name
List pgsql-bugs
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> > test=3D> create table a (
> > test(>   b    int    primary key
> > test(> );
> > NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "a_pkey"=
 for=3D
> >  table "a"
> > CREATE TABLE
> > test=3D> alter table a rename to c;
> > ALTER TABLE
> > test=3D> alter index a_pkey rename to c_pkey;
> > ALTER INDEX
>=20
> Arguably we should forbid ALTER INDEX RENAME on an index that belongs to
> a constraint, and make you rename the constraint instead (and have that
> implicitly change the index name too).

That would work too, though I don't think you can just rename a
constraint.  You have to drop/add it, which means dropping and then
adding the index back it looks like, which kind of sucks if it's a big
table (one reason I wasn't just dropping/recreating the table in the
first place).  This was on 8.0.3; can you rename constraints w/ 8.1?  If
so, and if that's made to implicitly change the index name, I'd be
happy.

    Thanks,

        Stephen

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Index name different from constraint name
Next
From: Tom Lane
Date:
Subject: Re: Index name different from constraint name