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

Re: change natural column order

From: "Joolz" <joolz(at)arbodienst-limburg(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Cc: "Tino Wildenhain" <tino(at)wildenhain(dot)de>
Subject: Re: change natural column order
Date: 2004-11-30 10:31:18
Message-ID: 38600.10.0.4.254.1101810678.squirrel@webmail.arbodienst-limburg.nl (view raw or flat)
Thread:
Lists: pgsql-general
Tino Wildenhain zei:
> Hi,
>
> Am Dienstag, den 30.11.2004, 10:26 +0100 schrieb Joolz:
>> Hello everyone,
>>
>> When I create a table and later on (say, because customers want to
>> store extra info) add a column, like this:
>>
>>   create table test (lastfield varchar);
>>   alter table test add column firstfield varchar;
>>
>> is it possible to change the natural order of the columns
>> afterwards? The reason I need this is because the frontend picks
>> up
>> table columns in natural order, looks at the datatype and creates
>> view, input and mutate (html) forms.
>>
>> I'd rather not use views, allthough I know this is "the right
>> way",
>> because it would make the application a lot more complex.
>>
>> Can I dive into some system tables and change the natural order?
>
> Natural Order? This is similar to a select without order by - the
> SQL standard says nothing about a natural order.

Hi Tino,

Yes, I know it's not very standard and certainly not in the spirit
of relational db's

> If you want to have a given ordering, why not just specify your
> column names in that order in your statements? Or just refer to
> them by column name if your host language allows it.

The frondend functions are made so they accept any query ("select
*") and find out or themselves how to handle things.

> I dont think the overhead in implementing such a rarely needed
> feature isnt worth it. We need a lot more other things ;-)

I agree. Only I think this wouldn't require new functionality, I
have a gut feeling that this is possible as it is. Now only find out
how :)

I'll have a look at the system tables (that's where the answer must
be) but maybe someone who has done this can save me the time...
Thanks!


In response to

Responses

pgsql-general by date

Next:From: Tino WildenhainDate: 2004-11-30 10:44:05
Subject: Re: change natural column order
Previous:From: Stefano BonninDate: 2004-11-30 10:30:16
Subject: Temporal query question

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