'create script' not usable for columns set 'not null' and 'default'

Поиск
Список
Период
Сортировка
От Rohan Carly
Тема 'create script' not usable for columns set 'not null' and 'default'
Дата
Msg-id 4FF2A163.1090203@rohan.id.au
обсуждение исходный текст
Ответы Re: 'create script' not usable for columns set 'not null' and 'default'  (Dave Page <dpage@pgadmin.org>)
Список pgadmin-support
In pgAdmin III v.1.14.1, if you navigate to 
schemas/public/tables/<table>/Columns/<column> and right-click on the column 
name and press "create script", you often get a script that will not execute.

The problem occurs when you have a column that has "NOT NULL" and a "DEFAULT" 
property.

e.g. A script generated by pgadmin might be as follows:
> -- Column: waged
>
> -- ALTER TABLE custom_ccowa_kwc DROP COLUMN waged;
>
> ALTER TABLE custom_ccowa_kwc ADD COLUMN waged2 integer;
> ALTER TABLE custom_ccowa_kwc ALTER COLUMN waged2 SET NOT NULL;
> ALTER TABLE custom_ccowa_kwc ALTER COLUMN waged2 SET DEFAULT 1;

But if you delete that column and insert the above text into the SQL editor 
and press "Execute query". then you get the following error message:

> ERROR:  column "waged2" contains null values
>
>
> ********** Error **********
>
> ERROR: column "waged2" contains null values
> SQL state: 23502

Could pgAdmin please be modified to generate a script like this instead:
> ALTER TABLE custom_ccowa_kwc ADD COLUMN waged2 integer NOT NULL DEFAULT 1;

Thanks for considering this, I couldn't find a similar bug report in the archives.



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

Предыдущее
От: Kozusznik Michal
Дата:
Сообщение: Re: default parameters
Следующее
От: Dave Page
Дата:
Сообщение: Re: 'create script' not usable for columns set 'not null' and 'default'