renaming indices?

Started by Alex Pilosovalmost 25 years ago3 messages
#1Alex Pilosov
alex@pilosoft.com

I'm running into a problem where I have to create an index with a name
that doesn't conflict with any existing index.

Currently, its not possible to do in postgres.

It'd be nice if either of 3 were implemented:
1) alter index to rename it

2) alter table would rename index with some option(?)

3) index namespace should be constricted to the table on which it is
indexed, since no commands to my knowledge manipulate the index without
also specifying the table. I.E. in such a way, I will have index a on
table foo, and index a on table bar without a conflcit.

Is there a specification of current postgres behaviour anywhere in SQL
standard? (i.e. index namespace being global?)

-alex

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alex Pilosov (#1)
Re: renaming indices?

ALTER TABLE RENAME works on indexes in 7.1; I forget about 7.0.

I think you're right that SQL expects indexes to have a separate
namespace from tables, but until we have schema/namespace support
it's pointless to worry about that.

regards, tom lane

#3Hannu Krosing
hannu@tm.ee
In reply to: Alex Pilosov (#1)
Re: renaming indices?

Alex Pilosov wrote:

3) index namespace should be constricted to the table on which it is
indexed, since no commands to my knowledge manipulate the index without
also specifying the table.

How about DROP INDEX ... ?

I'm not sure if this is standard SQL, maybe we should have
ALTER TABLE ... DROP INDEX ...

-----------------
Hannu