Re: column ordering, was Re: [PATCHES] Enums patch v2

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Zeugswetter Andreas ADI SD <ZeugswetterA(at)spardat(dot)at>, Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, pgsql-hackers(at)postgresql(dot)org, Gregory Stark <stark(at)enterprisedb(dot)com>
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2
Date: 2007-02-02 05:43:04
Message-ID: 200702020543.l125h4o10529@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Added to TODO:

> o Allow column display reordering by recording a display,
> storage, and permanent id for every column?
>
> http://archives.postgresql.org/pgsql-hackers/2006-12/msg00782.php
>

---------------------------------------------------------------------------

Jim C. Nasby wrote:
> On Thu, Dec 21, 2006 at 11:43:27AM -0500, Tom Lane wrote:
> > Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > > Tom Lane wrote:
> > >> You could make a case that we need *three* numbers: a permanent column
> > >> ID, a display position, and a storage position.
> >
> > > Could this not be handled by some catalog fixup after an add/drop? If we
> > > get the having 3 numbers you will almost have me convinced that this
> > > might be too complicated after all.
> >
> > Actually, the more I think about it the more I think that 3 numbers
> > might be the answer. 99% of the code would use only the permanent ID.
> > Display position would be used in *exactly* one place, namely while
> > expanding "SELECT foo.*" --- I can't think of any other part of the
> > backend that would care about it. (Obviously, client-side code such
> > as psql's \d would use it too.) Use of storage position could be
> > localized into a few low-level tuple access functions, probably.
> >
> > The problems we've been having with the concept stem precisely from
> > trying to misuse either display or storage position as a permanent ID.
> > That's fine as long as it actually is permanent, but as soon as you
> > want to change it then you have problems. We should all understand
> > this perfectly well from a database theory standpoint: pg_attribute
> > has to have a persistent primary key. (attrelid, attnum) is that key,
> > and we can't go around altering a column's attnum without creating
> > problems for ourselves.
>
> Is there enough consensus on this to add it to the TODO?
> --
> Jim Nasby jim(at)nasby(dot)net
> EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2007-02-02 05:57:41 Performance penalty of visibility info in indexes?
Previous Message Jim Nasby 2007-02-02 05:33:22 Re: PL/pgSQL RENAME functionality in TODOs

Browse pgsql-patches by date

  From Date Subject
Next Message Jeremy Drake 2007-02-02 06:16:54 Re: writing new regexp functions
Previous Message David Fetter 2007-02-02 05:11:42 Re: writing new regexp functions