From: | vinny <vinny(at)xs4all(dot)nl> |
---|---|
To: | Scara Maccai <m_lists(at)yahoo(dot)it> |
Cc: | <pgsql-general(at)postgresql(dot)org>, Kalai R <softlinne(dot)kv(at)gmail(dot)com> |
Subject: | Re: R: Field's position in Table |
Date: | 2009-08-20 09:24:49 |
Message-ID: | 0a4a445e106bc45529414e6cbe54af2a@xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 20 Aug 2009 09:21:25 +0000 (GMT), Scara Maccai <m_lists(at)yahoo(dot)it>
wrote:
>> When adding a new field in the existing table, i
>> want to add the filed in a particular position.
>
> I'm afraid the only way would be re-writing the whole table (pseudo
sql):
>
> BEGIN;
> create table newtable as select field1, 'newfield default value', field2
> from old_table;
> create_all_indexes on newtable;
> drop old_table;
> commit;
>
> things get complicated if you have foreign keys pointing to old_table...
Which is why you might be better off putting the new field at the end of
the table
and using an administrative view to make your viewing easier.
I can't really think of any real reason to put the field at a particular
position, applications
don't reallty care about the order of fields.
From | Date | Subject | |
---|---|---|---|
Next Message | Wolfgang Keller | 2009-08-20 09:59:32 | Generate LaTeX doc from PostgreSQL (autodoc)? |
Previous Message | Scara Maccai | 2009-08-20 09:21:25 | R: Field's position in Table |