Re: alter table - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: alter table
Date
Msg-id 20060215185428.GB12551@KanotixBox
Whole thread Raw
In response to alter table  (Maciej Piekielniak <piechcio@isb.com.pl>)
Responses Re: alter table  (Maciej Piekielniak <piechcio@isb.com.pl>)
List pgsql-sql
Maciej Piekielniak <piechcio@isb.com.pl> schrieb:

> Hello ,
> 
> How can i modify few fields with alter?
> 
> ALTER TABLE fv_wystawione
>   ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text),
>   ALTER imie SET DEFAULT '';  

test=# create table xyz (id int not null);
CREATE TABLE
test=# create sequence xyz_seq;
CREATE SEQUENCE
test=# alter table xyz alter column id set default nextval('xyz_seq');
ALTER TABLE


or:

test=# drop TABLE xyz;
DROP TABLE
test=# create table xyz (id int not null, foo varchar);
CREATE TABLE
test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default '';
ALTER TABLE



HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-sql by date:

Previous
From: Maciej Piekielniak
Date:
Subject: alter table
Next
From: Maciej Piekielniak
Date:
Subject: Re: alter table