Re: [SQL] alter help needed

From: "PAX!" <pvides(at)tnet(dot)es>
To: Frank Morton <fmorton(at)base2inc(dot)com>, PostgreSQL General <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] alter help needed
Date: 1998-11-30 12:41:34
Message-ID: 3662927E.28F02FD3@tnet.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Frank Morton wrote:

I think you coul do this with one select and one alter table. First you
create the new table with the adecuate structure, with a temp name. You
dum all the data with a select and drop the first table. Then you
change the name with alter table.

I hope it's useful.

>
> As an example, given a table with 2 columns, if I want to add
> a new column "between" the already existing columns, is there
> any way to use "alter table" to do this?
>
> The only way I can figure out how to do this and preserve the
> data is to dump the database and write a script to modify
> the dump by modifying the table structure plus the insert
> statements reflecting the change. This seems more painful
> and I must be missing an easier way to do this.
>
> I am trying to come up with an automated way to deal with
> multiple revisions of a database structure.
>
> Any help? Thanks.
>
> _________________________________
> Frank Morton (fmorton(at)mail(dot)base2inc(dot)com)
> Voice: (317) 876-3355
> FAX: (317) 876-3398
> Home: (317) 574-0815

--
La risa es la actitud primigenia hacia la vida:
un modo de acercamiento que pervive sólo en
criminales y artistas
-- Oscar Wilde

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1998-11-30 16:09:22 Re: Odd characters in inserted data...
Previous Message sqyang 1998-11-30 02:43:15 the differences between semaphores and spinlocks