Re: logical column position

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Dave Cramer <davec(at)fastcrypt(dot)com>
Subject: Re: logical column position
Date: 2003-11-18 01:40:15
Message-ID: 200311180140.hAI1eFD20021@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway wrote:
> I'd like to add a new column to pg_attribute that specifies the
> attribute's "logical position" within its relation. The idea here is
> to separate the logical order of the columns in a relation from the
> on-disk storage of the relation's tuples. This allows us to easily &
> quickly change column order, add an additional column before or after
> an existing column, etc.
>
> At present, attnum basically does three things: identifies an column
> within a relation, indicates which columns are system columns, and
> defines the order of a relation's columns. I'd like to move this last
> functionality into a separate pg_attribute column named "attpos" (or
> "attlogicalpos"):
>
> - when the table is created, attnum == attpos. System columns
> have attpos < 0, as with attnum. At no point will two
> columns of the same relation have the same attpos.
>
> - when returning output to the client and no column ordering
> is implied by the query (e.g. "SELECT * ..."), we sort the
> columns in ascending attpos order.

Seems the only cases where attpos would be used would be SELECT *,
INSERT with no column list, and COPY --- seems like a nifty feature.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-11-18 01:46:06 Re: Release cycle length
Previous Message Bruce Momjian 2003-11-18 01:39:15 Re: logical column position