[patch] ALTER RENAME and indexes

From: Brent Verner <brent(at)rcfile(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [patch] ALTER RENAME and indexes
Date: 2001-10-07 01:58:33
Message-ID: 20011006215833.A13452@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The attached patch works for my case...

regression=# create table test (id serial, col1 varchar(64));
NOTICE: CREATE TABLE will create implicit sequence 'test_id_seq' for SERIAL column 'test.id'
NOTICE: CREATE TABLE/UNIQUE will create implicit index 'test_id_key' for table 'test'
CREATE
regression=# create index i_t_c on test(col1);
CREATE
regression=# alter table test rename col1 to col2;
ALTER
regression=# \d test
Table "test"
Column | Type | Modifiers
--------+-----------------------+-------------------------------------------------
id | integer | not null default nextval('"test_id_seq"'::text)
col2 | character varying(64) |
Indexes: i_t_c
Unique keys: test_id_key

regression=# \d itc
Did not find any relation named "itc".
regression=# \d i_t_c
Index "i_t_c"
Column | Type
--------+-----------------------
col2 | character varying(64)
btree

wooohoo!!! Of course, it would be best if someone else looked this
code over, because I get the feeling there is an easier way to get
this done. The only thing I can say is that it solves my problem
and does not /appear/ to create any others.

cheers.
Brent

p.s., I appreciate the gurus not jumping in with the quick fix --
The experience has been fun :-)

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

Attachment Content-Type Size
pgsql.200110062153.diff text/plain 2.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Verner 2001-10-07 02:56:14 Re: ALTER RENAME and indexes
Previous Message Marc G. Fournier 2001-10-07 00:24:39 Re: anoncvs and CVS link off developers.postgresql.org