From: | Dmitriy Igrishin <dmitigr(at)gmail(dot)com> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: alter table add column - specify where the column will go? |
Date: | 2010-11-24 08:22:20 |
Message-ID: | AANLkTin6rKwJarHDFDuK+fzfJ27JMx6r2LToG=fLT2ot@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Please note, that in cases when you can't do simple
dump - fix - restore (e.g. in production) you can always create
view(s) with ordinal positions of columns convenient for you.
2010/11/24 Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
> Hey Alexander,
>
> Ordinal positions of columns can't be set manually by ALTER TABLE.
>
> 2010/11/24 Alexander Farber <alexander(dot)farber(at)gmail(dot)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(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
>
> --
> // Dmitriy.
>
>
>
--
// Dmitriy.
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Morgan Lloyd | 2010-11-24 09:08:27 | Getting current and average on a single row |
Previous Message | Thomas Kellerer | 2010-11-24 08:14:06 | Re: alter table add column - specify where the column will go? |