Andrew Sullivan mentioned :
=> I'm not sure why you want to do the former, but in any case, it's
Because lazy people write inserts without specifying column names.

=> possible by creating a new table which has things the way you want;
=> select all the old data from the old table into the new table (using
=> the column names to get everything in the order you like, of course),

I like this idea, but each database may have a different table definition
for the same table, and if I want to automate this, I need to figure out the 
column names on the fly.

=> and then rename the old table, rename the new table to the old table
=> name, and drop the old table if you like.

I think I've got the solution now. I'll do it in two steps. 
Fist add/drop all the columns that are not there/not supposed to be there,
and in the second step do what you suggested.

Thanks!!

Kind Regards
Stefan

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to