From: | Christian Kratzer <ck-lists(at)cksoft(dot)de> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | emilu(at)cs(dot)concordia(dot)ca, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to setup default value "0000-00-00" for "date" |
Date: | 2004-08-20 08:20:42 |
Message-ID: | 20040820101606.L66985@vesihiisi.cksoft.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
On Fri, 20 Aug 2004, Richard Huxton wrote:
> Emi Lu wrote:
>> Hello all,
>>
>> I have a question about "date" & "timestamp" types in PostgreSQL. I want
>> to setup the default value '0000-00-00' and "0000-00-00 00:00:00" for
>> them. However, it seems that PostgreSQL does not support it. Could someone
>> helps me please?
>
> PostgreSQL doesn't and almost certainly never will support "0000-00-00" as a
> date. That's because it isn't a valid date. You also can't store 13.723,
> "Hello world" or (12,13) in a date column either.
>
> Where you don't have a valid date to store you should use NULL. This business
> of storing zeroes is a horrible MySQL design mistake.
which is because the last time when I last used mysql it did not support
NULLs in indexed columns (at least not in myisam tables).
The workaround was to use something else like 0 to represent undefined
values.... Horrible ...
Greetings
Christian
--
Christian Kratzer ck(at)cksoft(dot)de
CK Software GmbH http://www.cksoft.de/
Phone: +49 7452 889 135 Fax: +49 7452 889 136
From | Date | Subject | |
---|---|---|---|
Next Message | Michal Taborsky | 2004-08-20 08:39:42 | Re: How to setup default value "0000-00-00" for "date" |
Previous Message | Richard Huxton | 2004-08-20 08:09:17 | Re: need help |