Alter table not correct for Postgres 8.0+

Поиск
Список
Период
Сортировка
От Gary Doades
Тема Alter table not correct for Postgres 8.0+
Дата
Msg-id 419F9055.2020105@gpdnet.co.uk
обсуждение исходный текст
Список pgadmin-support
If I try to add a column that is not null with a default the SQL that 
gets generated is:

ALTER TABLE control   ADD COLUMN security_options int;
ALTER TABLE control   ALTER COLUMN security_options SET NOT NULL;
ALTER TABLE control   ALTER COLUMN security_options SET DEFAULT 32;

This generates an error if the table already contains rows.

Whereas from 8.0 the following will work and ought to be used instead:

ALTER TABLE control   ADD COLUMN security_options int not null default 32;


Thanks,
Gary.


В списке pgadmin-support по дате отправления: