Re: Possible bug in ALTER TABLE RENAME COLUMN (PostgreSQL

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: "'Bruce Momjian'" <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: "'pgsql-bugs(at)postgresql(dot)org'" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: Possible bug in ALTER TABLE RENAME COLUMN (PostgreSQL
Date: 2001-10-12 19:40:13
Message-ID: AA30E7BCCA5C1D4E88A231900F8325C00BAD@dogbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Great, thanks for letting me know Bruce.

Regards, Dave.

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman(at)candle(dot)pha(dot)pa(dot)us]
> Sent: 12 October 2001 18:54
> To: Dave Page
> Cc: 'pgsql-bugs(at)postgresql(dot)org'
> Subject: Re: [BUGS] Possible bug in ALTER TABLE RENAME COLUMN
> (PostgreSQL 7.1.3)
>
>
>
> This appears to be fixed:
>
> test=> CREATE TABLE sheep (cow text);
> CREATE
> test=> CREATE INDEX goat ON sheep (cow);
> CREATE
> test=> ALTER TABLE sheep RENAME cow TO chicken;
> ALTER
> test=> \d sheep
> Table "sheep"
> Column | Type | Modifiers
> ---------+------+-----------
> chicken | text |
> Indexes: goat
>
> test=> \d goat
> Index "goat"
> Column | Type
> ---------+------
> chicken | text
> btree
>
>
> --------------------------------------------------------------
> -------------
>
> > Hi,
> >
> > During testing of new revision control code in pgAdmin II,
> I've found
> > that renaming an indexed column in a table does not automatically
> > update the index column name in pg_attribute. pg_get_indexdef does
> > return the correct definition however:
> >
> > helpdesk=# CREATE TABLE sheep (cow text);
> > CREATE
> > helpdesk=# CREATE INDEX goat ON sheep (cow);
> > CREATE
> > helpdesk=# \d goat
> > Index "goat"
> > Attribute | Type
> > -----------+------
> > cow | text
> > btree
> >
> > (END)
> > helpdesk=# ALTER TABLE sheep RENAME cow TO chicken;
> > ALTER
> > helpdesk=# \d sheep
> > Table "sheep"
> > Attribute | Type | Modifier
> > -----------+------+----------
> > chicken | text |
> > Index: goat
> >
> > (END)
> > helpdesk=# \d goat
> > Index "goat"
> > Attribute | Type
> > -----------+------
> > cow | text
> > btree
> >
> > (END)
> > helpdesk=# SELECT pg_get_indexdef((SELECT oid FROM pg_class WHERE
> > relname = 'goat'));
> > pg_get_indexdef
> > -----------------------------------------------------------
> > CREATE INDEX goat ON sheep USING btree (chicken text_ops)
> > (1 row)
> >
> > (END)
> >
> > (Please CC any replies as I'm not on this list)
> >
> > Regards, Dave.
> >
> > --
> > Dave Page (dpage(at)postgresql(dot)org)
> > http://pgadmin.postgresql.org/
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 6: Have you searched our list archives?
> >
> > http://archives.postgresql.org
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill,
> Pennsylvania 19026
>

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2001-10-12 19:47:55 Re: Index Scans Oddness
Previous Message Stephan Szabo 2001-10-12 18:47:40 Re: [GENERAL] Cant get planner to use index (7.1.3-1PGDG)