Re: logical column position

From: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
To: pg(at)fastcrypt(dot)com
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Neil Conway <neilc(at)samurai(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logical column position
Date: 2003-11-19 18:45:08
Message-ID: 3FBBBA34.4090703@pse-consulting.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dave Cramer wrote:

>Andreas,
>
>
>On Wed, 2003-11-19 at 13:07, Andreas Pflug wrote:
>
>
>>Dave Cramer wrote:
>>
>>
>>
>>>Andreas,
>>>
>>>The point of this is to maintain the column position. I don't think that
>>>an alter of a column type should move the column position.
>>>
>>>
>>>
>>Why should ALTER COLUMN change the column number, i.e. position?
>>
>>
>
>Rod's current proposed patch does that if you do an alter column alter
>type. This is an artifact of the underlying mechanism. (ren old col, add
>new col, update newcol=oldcol::newtype).
>
I must have missed that, can't find it in hackers?!?
In this case the old attnum value should simply be reused, to retain the
original ordering. IMHO this is necessary to prevent problems with any
object referencing a column (index, view, ...) The current proposal
invents the attpos for column ordering purpose only, but
views/indexes/etc will reference attnum, and would need updates.

Actually, a column that changes its attnum is just like a table changing
its oid, i.e. it's not the same object any more. This will provoke
problems in administration tools (at least in pgAdmin3, which will try
to refresh its display with the formerly known oid/attnum af ter
executing a change), and maybe other places too.

To put it differently: a ALTER COLUMN command may never-ever change the
identifier of the column, i.e. attrelid/attnum.

Regards,
Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Austin Gonyou 2003-11-19 18:48:57 Re: Commercial binary support?
Previous Message Peter Eisentraut 2003-11-19 18:18:28 Re: Build farm