Re: [patch] ALTER RENAME and indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brent Verner <brent(at)rcfile(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [patch] ALTER RENAME and indexes
Date: 2001-10-07 14:56:09
Message-ID: 20384.1002466569@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Serguei Mokhov 2001-10-07 18:22:13 PG_DUMP NLS (Russian)
Previous Message Brent Verner 2001-10-07 12:49:10 Re: ALTER RENAME and indexes