Re: Inserting a Null date.

Поиск
Список
Период
Сортировка
Искать
От
Josh Berkus
Тема
Re: Inserting a Null date.
Дата
Msg-id
200402021322.21879.josh@agliodbs.com
Ответ на
Список
Дерево обсуждения
Inserting a Null date. Rob Mosher <mosher@andrews.edu>
Re: Inserting a Null date. Josh Berkus <josh@agliodbs.com>
Re: Inserting a Null date. Josh Berkus <josh@agliodbs.com>
Re: Inserting a Null date. Rob Mosher <mosher@andrews.edu>
Re: Inserting a Null date. Josh Berkus <josh@agliodbs.com>
Re: Inserting a Null date. Nabil Sayegh <postgresql@e-trolley.de>
Rob,

> I am trying to add entries to my database via a Perl script, where some 
> fields are optional, that is, nulls are allowed. When inserting an 
> entry, I include every field in the insert statement, but leave their 
> value undefined if it is optional and left blank. This works for every 
> field but date fields. Setting a date field to undefined generates the 
> error "Bad date external representation". Is there a way to leave a date 
> field null while still having it as an argument in an insert (i.e. INSET 
> INTO table (id, mydate) VALUES (1, NULL) ), or will I need to make 
> several different insertion statements for each different case?

Inserting a null should work fine.   Are you sure Perl isn't passing an empty 
string ( '' ) instead?

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco

В списке pgsql-novice по дате отправления
От: remi@internetworker.net (Remi)
Дата:
От: Josh Berkus
Дата:
Сообщение: Re: Inserting a Null date.
FAQ