Re: logical column position

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: pg(at)fastcrypt(dot)com, 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 22:38:23
Message-ID: 1069281503.3201.81.camel@fuji.krosing.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andreas Pflug kirjutas K, 19.11.2003 kell 20:45:
> Dave Cramer wrote:
> >>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?!?

Was on [PATCHES] IIRC.

> 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, ...)

Actually these have to be recreaqted, especially when changing column
type.

Rod's patchs does that too ;)

> The current proposal
> invents the attpos for column ordering purpose only,

That's the only place _user_ sees it. The other uses are taken care of
inide database backend.

> but
> views/indexes/etc will reference attnum, and would need updates.

they also "reference" column type, and thus need to be updated anyway
when column type changes.

> 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.

Sure. _any_ change to database structure could break a client not
(designed to be) aware of that change.

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

to be even more restirictive: ALTER COLUMN may never-ever change the
type of the column, as this too may break some apps. Nah!

-------------
Hannu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2003-11-19 23:02:54 Re: Commercial binary support?
Previous Message Joshua D. Drake 2003-11-19 22:23:39 Re: RPM building fun