Re: Add Column BEFORE/AFTER another column

Поиск
Список
Период
Сортировка
От Steve Atkins
Тема Re: Add Column BEFORE/AFTER another column
Дата
Msg-id CDAAF465-8AB8-487D-A56F-62814F927558@blighty.com
обсуждение исходный текст
Ответ на Re: Add Column BEFORE/AFTER another column  (Matthew <mboehm@voilaip.com>)
Список pgsql-general
On Aug 24, 2007, at 2:18 PM, Matthew wrote:

> Hey Bill,
>
>> It does not.
>
>     Bummer.
>
>> To get your columns in a specific order, specify the column names in
>> that order in your SELECT statement.  The SQL standard doesn't
>> provide
>> for any other way to guarantee column order, and neither does
>> Postgres.
>
>     Yes, I realize this and we do identify our columns during select
> statements, but when you look at a table using a tool like
> phpPGAdmin or
> pgAdmin3, the columns are displayed in some defined order.  It's much
> easier to see your data/columns in some logical order (ie: all the
> cost
> columns next to each other).

Using a view might give you what you're looking for:

   abacus=# select * from access_role;
    id | name
   ----+-------
     1 | user
     2 | admin
   (2 rows)

   abacus=# create view bass_ackwards as select name, id from
access_role;
   CREATE VIEW
   abacus=# select * from bass_ackwards;
    name  | id
   -------+----
    user  |  1
    admin |  2
   (2 rows)

Cheers,
   Steve


В списке pgsql-general по дате отправления:

Предыдущее
От: Matthew
Дата:
Сообщение: Re: Add Column BEFORE/AFTER another column
Следующее
От: "Alexander Staubo"
Дата:
Сообщение: Re: PostgreSQL vs Firebird feature comparison finished