Re: Add Column BEFORE/AFTER another column

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: Add Column BEFORE/AFTER another column
Дата
Msg-id 20070824171118.6e37a202.wmoran@potentialtech.com
обсуждение исходный текст
Ответ на Add Column BEFORE/AFTER another column  (Matthew <mboehm@voilaip.com>)
Ответы Re: Add Column BEFORE/AFTER another column
Список pgsql-general
In response to Matthew <mboehm@voilaip.com>:

> Hi gang,
>  In MySQL it is possible to add a column before/after another column. I
> have not been able to find such syntax in the Postgres manual. Does this
>  ability exist?

It does not.

> Is my only solution to create a new table with the new column, copy the
> data, delete the old table and rename the new one?

The fact that you're asking this question is a hint that you're using
unsafe coding practices that may bite you at some point.  The order
of columns is not guaranteed to be the same as when you do CREATE
TABLE, it's just coincidence that they usually are.

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.

--
Bill Moran
http://www.potentialtech.com

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

Предыдущее
От: Matthew
Дата:
Сообщение: Add Column BEFORE/AFTER another column
Следующее
От: Matthew
Дата:
Сообщение: Re: Add Column BEFORE/AFTER another column