It occurs to me that the real problem is not so much ALTER RENAME not
doing enough, as it is psql doing the wrong thing.  The \d display for
indexes is almost entirely unhelpful, since it doesn't tell you such
critical stuff as whether the index is a functional index nor which
index opclasses are being used.  I wonder whether we oughtn't rip out
the whole display and make it report the results of pg_get_indexdef(),
instead.

regression=# create table foo(f1 int,f2 int, primary key(f1,f2));
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
CREATE
regression=# \d foo
         Table "foo"
 Column |  Type   | Modifiers
--------+---------+-----------
 f1     | integer | not null
 f2     | integer | not null
Primary key: foo_pkey

regression=# create index foofn on foo (int4pl(f1,f2));
CREATE
regression=# \d foofn
  Index "foofn"
 Column |  Type
--------+---------
 int4pl | integer
btree

regression=# select pg_get_indexdef(oid) from pg_class where relname = 'foofn';
                    pg_get_indexdef
--------------------------------------------------------
 CREATE INDEX foofn ON foo USING btree (int4pl(f1, f2))
(1 row)

regression=# alter table foo rename f1 to f1new;
ALTER
regression=# select pg_get_indexdef(oid) from pg_class where relname = 'foofn';
                      pg_get_indexdef
-----------------------------------------------------------
 CREATE INDEX foofn ON foo USING btree (int4pl(f1new, f2))
(1 row)


                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to