Re: Column reordering in pg_dump

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Decibel! <decibel(at)decibel(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, hernan gonzalez <hgonzalez(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Column reordering in pg_dump
Date: 2008-11-25 22:40:07
Message-ID: 20081125224007.GB27273@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 25, 2008 at 03:10:30PM -0600, Decibel! wrote:
> IIRC the community did come to a consensus on allowing for a
> different logical ordering from physical ordering, it was an issue of
> actually doing the work. If this is an itch you want to scratch, you
> might look into fixing that problem instead.

Err, as I recall it was decided that the chance for confusion was too
high.

http://www.mail-archive.com/pgsql-hackers(at)postgresql(dot)org/msg85548.html

However, it seems to me we could have "reasonably bulletproof or
machine-checkable way to keep the two kinds of column numbers
distinct", like so:

typedef struct { short log; } logical_pos;
typedef struct { short phys; } physical_pos;

This doesn't change the size of the objects, but the compiler will
prevent them from being assigned interchangably.

It does mean you need to use macros to access them, even if it's in a
loop. Fortunatly, we don't need to do too much arithmetic on them.

If the size of the object doesn't matter, you can do thing like typedef
a pointer to a one byte struct. Then most standard arithmetic
operations will still work (IIRC the Linux kernel uses this trick a
lot).

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-11-25 22:55:41 mingw doesn't like PGOPTIONS?
Previous Message Robert Haas 2008-11-25 22:32:11 Re: [Fwd: error compiling postgresql with fedora mingw]