Re: BUG #14407: pg_attribute shows old column names for indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: bashtanov(at)imap(dot)cc
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14407: pg_attribute shows old column names for indexes
Date: 2016-11-01 13:34:03
Message-ID: 16863.1478007243@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

bashtanov(at)imap(dot)cc writes:
> create table tt(a int primary key);
> alter table tt rename column a to b;
> select attrelid::regclass, attname from pg_attribute where attrelid =
> any('{tt,tt_pkey}'::regclass[]) and attnum > 0;

This is not a bug; we don't attempt to rename index columns when changing
the name of a heap column. It would create collision hazards and gain
little.

If you want to see what the columns of an index actually are, I suggest
psql's \d command. In this example it produces

regression=# \d tt_pkey
Index "public.tt_pkey"
Column | Type | Definition
--------+---------+------------
a | integer | b
primary key, btree, for table "public.tt"

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message vcolborn 2016-11-01 19:26:55 BUG #14408: Schema not found error when 2 or more indices declared on temporary table
Previous Message bashtanov 2016-11-01 10:22:26 BUG #14407: pg_attribute shows old column names for indexes