Re: alter table

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: alter table
Date: 2006-02-15 18:54:28
Message-ID: 20060215185428.GB12551@KanotixBox
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Maciej Piekielniak <piechcio(at)isb(dot)com(dot)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°

In response to

  • alter table at 2006-02-15 18:11:56 from Maciej Piekielniak

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Maciej Piekielniak 2006-02-15 19:23:50 Re: alter table
Previous Message Maciej Piekielniak 2006-02-15 18:11:56 alter table