Re: alter table add column - specify where the column will go?

From: Derrick Rice <derrick(dot)rice(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: alter table add column - specify where the column will go?
Date: 2010-11-24 16:42:08
Message-ID: AANLkTimwef2BY8yKZG1orcSUok5Kh=idqeUMdSRFXHpH@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 24, 2010 at 4:43 AM, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> Grzegorz Jaśkiewicz, 24.11.2010 10:37:
>
> just never use SELECT *, but always call columns by names. You'll
>> avoid having to depend on the order of columns, which is never
>> guaranteed, even if the table on disk is one order, the return columns
>> could be in some other.
>>
>> I always try to convince people of this as well, but when they ask me
> under which circumstances this could happen, I can't think of a proper
> example.
>
> Does anybody have an example that would show this?
>
> Regards
> Thomas
>

Even if an example doesn't exist, you can at least imagine a scenario where
an improvement to postgresql is made such that the column order is decided
internally, rather than by table definition. If the warning isn't given
now, that improvement won't be possible. So I read that as "Don't rely on
the table order, it's not part of the interface/contract and we're going to
change it if we want to".

Derrick

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stuart McGraw 2010-11-24 17:14:46 Re: alter table add column - specify where the column will go?
Previous Message Sebastian Jaenicke 2010-11-24 16:41:33 Re: Postgres 9 and postgis1.5.2