Search Postgresql Archives

R: Field's position in Table

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

 



> 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...








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


[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