Re: Reordering columns, will this ever be simple?

Поиск
Список
Период
Сортировка
От Josh Trutwin
Тема Re: Reordering columns, will this ever be simple?
Дата
Msg-id 20070807135047.536f00dc@sinkhole.intrcomm.net
обсуждение исходный текст
Ответ на Reordering columns, will this ever be simple?  (novnov <novnovice@gmail.com>)
Ответы Re: Reordering columns, will this ever be simple?
Список pgsql-general
On Tue, 7 Aug 2007 11:07:39 -0700 (PDT)
novnov <novnovice@gmail.com> wrote:

<snip>

> Is there any plan to add such a capability to postgres? Is there
> deep seated reason why reordering columns can't be handled without
> doing a root canal on the database?

Probably because the theory behind the relational model (at least as
far as I understand it) is that column and row ordering is irrelevant.

From http://en.wikipedia.org/wiki/Relational_model :

"The relational model requires there to be no significance to any
ordering of the attributes of a relation."

Just like if you do a SELECT * that the order of the rows returned
could change at any time unless you specify an ORDER BY clause.

That said, most people I imagine like being able to "re-order" the
columns that a SELECT * produces.

> If there already is some simple way to reorder columns, please let
> me know.

CREATE VIEW my_favorite_order AS
  SELECT col2, col1, col5, col4, etc
    FROM base_table;

SELECT * FROM my_favorite_order;

Only drawback is that you have to re-build the view if the column
names in the base table change.

Josh

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: Auto Starting +/or Shutdown on OS X
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: finding out vacuum completion %, and vacuum VS vacuum full