Skip site navigation (1) Skip section navigation (2)

Re: Renaming a constraint's index

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Decibel! <decibel(at)decibel(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Renaming a constraint's index
Date: 2008-01-17 20:41:30
Message-ID: 14183.1200602490@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Decibel! <decibel(at)decibel(dot)org> writes:
> On Jan 16, 2008, at 5:20 PM, Tom Lane wrote:
>> There seem to be three things we could do:
>> 
>> 1. Make ALTER INDEX RENAME fail if the index belongs to a constraint.
>> This is trivial code-wise, but doesn't seem especially helpful to  
>> users.

> +1. IMO, the constraint should be the canonical source of the name,  
> not the other way around.

>> 2. Make ALTER INDEX RENAME automatically rename the constraint, too.
>> This would take a few dozen lines of code but is certainly not hard.

> -1 (see above)
> ...
> Like I said, I don't think it makes sense for the index to drive  
> constraint names.

Maybe not, but as long as psql \d shows indexes rather than constraints,
there'll be an awfully strong bias to use ALTER TABLE/ALTER INDEX
when you decide you don't like the name.  I don't see any great
moral failing in allowing things to be renamed either way.

			regards, tom lane

In response to

pgsql-hackers by date

Next:From: Joshua D. DrakeDate: 2008-01-17 21:20:50
Subject: Simple thing to make pg_autovacuum more useful
Previous:From: Josh BerkusDate: 2008-01-17 20:13:24
Subject: Re: proposal for 8.4: PL/pgSQL - statement CASE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group