Search Postgresql Archives

Re: alter table add column - specify where the column will go?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey Alexander,

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

2010/11/24 Alexander Farber <alexander.farber@xxxxxxxxx>
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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
// Dmitriy.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux