Re: alter table add column - specify where the column will go? - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: alter table add column - specify where the column will go?
Date
Msg-id AANLkTikJuNVdUHM17ERQUWoaNsWNXe88iMT2omAFbvhU@mail.gmail.com
Whole thread Raw
In response to alter table add column - specify where the column will go?  (Alexander Farber <alexander.farber@gmail.com>)
Responses Re: alter table add column - specify where the column will go?
List pgsql-general
Hey Alexander,

Ordinal positions of columns can't be set manually by ALTER TABLE.

2010/11/24 Alexander Farber <alexander.farber@gmail.com>
Hello,

is there a syntax to add a column not at the last place, but
somewhere inbetween or do I have to dump/restore the table?

For example if I'd like to add last_logout right after last_login:

 \d pref_users;
               Table "public.pref_users"
  Column   |            Type             |   Modifiers
------------+-----------------------------+---------------
 id         | character varying(32)       | not null
 first_name | character varying(32)       |
 last_name  | character varying(32)       |
 female     | boolean                     |
 avatar     | character varying(128)      |
 city       | character varying(32)       |
 lat        | real                        |
 lng        | real                        |
 last_login | timestamp without time zone | default now()
 last_ip    | inet                        |
 medals     | smallint                    | default 0

Thank you
Alex

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
// Dmitriy.


pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: alter table add column - specify where the column will go?
Next
From: Alexander Farber
Date:
Subject: Re: alter table add column - specify where the column will go?