Re: alter table
От | Gregory Wood |
---|---|
Тема | Re: alter table |
Дата | |
Msg-id | 001701c179be$4075be90$7889ffcc@comstock.com обсуждение исходный текст |
Ответ на | alter table ("Yuri A. Kabaenkov" <sec@artofit.com>) |
Ответы |
Re: alter table
|
Список | pgsql-general |
According to the documentation: ALTER TABLE table [ * ] ADD [ COLUMN ] column type Which means you can only set the column type of the new column. You'll have to go back and alter that column to add a default: ALTER TABLE table [ * ] ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT } You'll no doubt also want to add that NOT NULL constraint: ALTER TABLE table ADD table constraint definition I know this only because it bit me in the ass the other day too :) Greg ----- Original Message ----- From: "Yuri A. Kabaenkov" <sec@artofit.com> To: <pgsql-general@postgresql.org> Sent: Friday, November 30, 2001 10:22 AM Subject: [GENERAL] alter table > Hello, > > I've read documentation on alter table syntax and doesn't find > anything about change column type or drop column. > > Also when i add column by command > alter table test add column a integer not null default '10' > > It adds column but doesn't set default value. > > How can i fix it? > > > > ------------ > With respect, > Yuri A. Kabaenkov > hellman@artofit.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >
В списке pgsql-general по дате отправления: