pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14407: pg_attribute shows old column names for indexes
2+ messages / 2 participants
[nested] [flat]
* BUG #14407: pg_attribute shows old column names for indexes
@ 2016-11-01 10:22 bashtanov@imap.cc
2016-11-01 13:34 ` Re: BUG #14407: pg_attribute shows old column names for indexes Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 2+ messages in thread
From: bashtanov@imap.cc @ 2016-11-01 10:22 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14407
Logged by: Alexey Bashtanov
Email address: bashtanov@imap.cc
PostgreSQL version: 9.6.1
Operating system: Ubuntu Linux 14.04.4 LTS
Description:
STEPS TO REPRODUCE:
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;
EXPECTED:
attrelid | attname
----------+---------
tt | b
tt_pkey | b
RECEIVED:
attrelid | attname
----------+---------
tt | b
tt_pkey | a
reproduced on 9.4.9, 9.6.1 and master
Regards,
Alexey
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #14407: pg_attribute shows old column names for indexes
2016-11-01 10:22 BUG #14407: pg_attribute shows old column names for indexes bashtanov@imap.cc
@ 2016-11-01 13:34 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2016-11-01 13:34 UTC (permalink / raw)
To: bashtanov@imap.cc; +Cc: pgsql-bugs
bashtanov@imap.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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-11-01 13:34 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-11-01 10:22 BUG #14407: pg_attribute shows old column names for indexes bashtanov@imap.cc
2016-11-01 13:34 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox