> > Adding columns is directly supported. Removing columns, or redefining
> > them, is done with a CREATE TABLE AS/DROP TABLE/CREATE TABLE AS/DROP
> > TABLE sequence, where you write the columns you want to retain into a
> > temporary table, delete the original table, and then do the same back
> > into a new table with the same name as the original.
> But this method might lose some characteristics such as primary key,
> unique constraints, no?
OK, then CREATE TABLE AS/DROP TABLE/CREATE TABLE/INSERT/DROP TABLE,
where the CREATE TABLE can include all relevant characteristics.
btw, Tatsuo reminds me that if you have a SERIAL type, you will need
to retain the underlying sequence which supports it, define the column
in the new table as an INT, and define the DEFAULT clause for it to
reference the sequence explicitly.
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California
In response to
pgsql-interfaces by date
|Next:||From: Rusty Brooks||Date: 1999-08-31 14:25:24|
|Subject: Re: [INTERFACES] ODBC Questions|
|Previous:||From: Tatsuo Ishii||Date: 1999-08-31 13:59:38|
|Subject: Re: [INTERFACES] How do I drop a column from a table? |