Re: problem with Pl/Pgsql function

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: problem with Pl/Pgsql function
Дата
Msg-id web-70261@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на problem with Pl/Pgsql function  ("Matteo Centenaro" <gente_che_mixa@hotmail.com>)
Список pgsql-sql
Matteo,

> The error riported is:
> 
> Fail to add null value in not null attribute prefisso
> 
> The line which the error refere is:
> 
> id_lista := nextval('tab_estrazioni_id_seq');
> insert into tab_estrazioni values (id_lista, pre, tel);
> 
> Has Anybody any suggest? Thanks!

While my Italian isn't really good enough to analyze your function, the
above error seems simple.  tab_estrazioni probably has the field
prefisso, which is defined as NOT NULL with no default.  In the above
code, you're trying to add a record to tab_estrazioni filling in only
the columns id_lista, pre, and tel.  Without a default or a supplied
value, this inserts NULL into the prefisso column, which the database
rejects.

Thus the solution is to either: a) Change prefisso to NULL, b) give
prefisso a default, or c) supply a value for prefisso.  Unfortunatley,
the first two require dropping and re-creating the table.

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


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

Предыдущее
От: "Michael Richards"
Дата:
Сообщение: finding a maximum or minimum sum
Следующее
От: "Josh Berkus"
Дата:
Сообщение: Re: Table design issue....