Обсуждение: null value in date field

Поиск
Список
Период
Сортировка

null value in date field

От
Jeff Deroshia
Дата:
I have a form that contains optional DATE fields.  To enter null
values, I've tried null, 'null', '', '-', '0', 0, and each time I get
the following error:

ERROR:  Bad numeric input format ''

Is there a correct way to enter null values into DATE fields?

Thanks,
Jeff Deroshia


Re: null value in date field

От
Stephan Szabo
Дата:
On Tue, 18 Feb 2003, Jeff Deroshia wrote:

> I have a form that contains optional DATE fields.  To enter null
> values, I've tried null, 'null', '', '-', '0', 0, and each time I get
> the following error:
>
> ERROR:  Bad numeric input format ''

Are you sure this is on a date field?  Date should be giving you
something like (at least in 7.3):
 ERROR: Bad date external representation ''

Null works for me...
sszabo=# create table test(a date);
CREATE TABLE
sszabo=# insert into test (a) values (null);
INSERT 4256129 1
sszabo=# insert into test (a) values ('');
ERROR:  Bad date external representation ''




Re: null value in date field

От
Larry Rosenman
Дата:

--On Tuesday, February 18, 2003 14:47:44 -0500 Jeff Deroshia
<jeff@hal.physast.uga.edu> wrote:

> I have a form that contains optional DATE fields.  To enter null values,
> I've tried null, 'null', '', '-', '0', 0, and each time I get the
> following error:
>
> ERROR:  Bad numeric input format ''
>
> Is there a correct way to enter null values into DATE fields?
NULL outside of quotes.


>
> Thanks,
> Jeff Deroshia
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>



--
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 972-414-9812                 E-Mail: ler@lerctr.org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749