Please add the ability to add columns into the middle of a table.
От | Patrick Headley |
---|---|
Тема | Please add the ability to add columns into the middle of a table. |
Дата | |
Msg-id | 572CEE07.2080600@linxco-inc.com обсуждение исходный текст |
Ответы |
Re: Please add the ability to add columns into the
middle of a table.
|
Список | pgadmin-support |
Having the ability to insert a column in the middle of a table using the PGAdmin 3 UI would be very nice. Benefits includegrouping related fields and creating a column list in the natural flow of data entry. Having it automated within theUI would make this piece of DB management so much easier.<br /><br /> I am able to write scripts that do this but it takesa long time to write the scripts on tables with lots of dependencies, partly because:<br /> 1) Dependencies and constraintshave to be dropped first and in the correct order.<br /> 2) Dependencies and constraints have to be recreatedin the correct order.<br /><br /> Basically, the scripts I write perform these steps:<br /> 1) Drop constraints.Sometimes I'll also drop a sequence, but not always.<br /> 2) Drop dependencies in the correct order. The challengeis getting the order correct. I have to run the script within a transaction and see what errors come up. Roll backany changes, fix any errors and try again.<br /> 3) Rename the original table.<br /> 4) Create a replacement table withthe new columns in the position I choose. I do this by copying the existing table definition first. This makes it easyto create the new table with constraints, indexes, permissions and comments.<br /> 5) Make sure any sequence used bythe table has the correct value.<br /> 6) Drop the original table.<br /> 7) Rebuild dependencies (in the correct order).<br/><br /><div class="moz-signature">-- <br /><b><i>Patrick Headley</i></b><br /> Linx Consulting, Inc.<br /><a class="moz-txt-link-abbreviated"href="mailto:pheadley@linxco-inc.com">pheadley@linxco-inc.com</a><br /><a class="moz-txt-link-abbreviated"href="http://www.linxco-inc.com">www.linxco-inc.com</a></div>
В списке pgadmin-support по дате отправления: