Skip site navigation (1) Skip section navigation (2)

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

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Zeugswetter Andreas ADI SD <ZeugswetterA(at)spardat(dot)at>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,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: 2006-12-21 16:11:46
Message-ID: 20061221161146.GF14992@svana.org (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Thu, Dec 21, 2006 at 05:06:53PM +0100, Zeugswetter Andreas ADI SD wrote:
> > The thing is, physical index numbers has meaning, the logical index
> > number does not. In a view definition we're going to store the
> > physical index, not the logical one, for example. We don't want
> > rearranging columns to invalidate view definitions or plans.
> 
> I think we lack a definition here:
> 
> logical number:	the order of columns when doing select *
> physical number:	the position inside the heap tuple (maybe with
> offset)
> 
> All views and plans and index definitions and most everyting else 
> needs to reference the logical number.

Huh? If I have an index on the first two columns of a table, it's going
to refernce columns 1 and 2.

If you alter the table to put a column in front of those two, the new
column will be physical 3, logical 1.

If the index references logical numbers, the index has just been
broken. If the index references physical numbers, everything works
without changes.

Same with views, if you use logical numbers you have to rebuild the
view each time. Why bother, when physical numbers work and don't have
that problem?

Have a nice day,
-- 
Martijn van Oosterhout   <kleptog(at)svana(dot)org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2006-12-21 16:15:38
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2
Previous:From: Martijn van OosterhoutDate: 2006-12-21 16:07:20
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2

pgsql-patches by date

Next:From: Tom LaneDate: 2006-12-21 16:15:38
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2
Previous:From: Martijn van OosterhoutDate: 2006-12-21 16:07:20
Subject: Re: column ordering, was Re: [PATCHES] Enums patch v2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group