Re: ALTER COLUMN/logical column position - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ALTER COLUMN/logical column position
Date
Msg-id 4437.1069343366@sss.pgh.pa.us
Whole thread Raw
In response to Re: ALTER COLUMN/logical column position  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> Tom Lane writes:
>> Exactly.  I'm considerably more worried about breaking out-of-the-way
>> places in the backend than I am about what order someone's admin tool
>> presents the columns in.

> Clearly, the effort of adding logical column numbers will consist of
> making choices between physical and logical numbers in the backend in some
> places.  So one option is to replace some uses of attnum by attlognum.
> The other optionis to replace *all* uses of attnum by attphysnum and then
> replace some uses of attphysnum by attnum.  To me, this looks like an
> equal "risk" as far as the backend goes.

This would be a reasonable assessment if we had our hands on every line
of backend code that exists.  But you are neglecting the probability of
breaking user-written C functions, PL languages outside the main distro,
etc.

If we were going to go about this in a way that does not localize the
changes, I'd be inclined to use "attlognum" and "attphysnum" ... that
is, *deliberately* break every use that hasn't been looked at and
updated.  Even that would not guarantee catching all the trouble spots;
for example loop indexes and attnums passed as function parameters might
not have names that would be caught by a simplistic search-and-replace
update.

I'm for localizing the changes.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: ALTER COLUMN/logical column position
Next
From: Alvaro Herrera Munoz
Date:
Subject: Re: logical column position