Re: How to setup default value "0000-00-00" for "date"

Поиск
Список
Период
Сортировка
От Christian Kratzer
Тема Re: How to setup default value "0000-00-00" for "date"
Дата
Msg-id 20040820101606.L66985@vesihiisi.cksoft.de
обсуждение исходный текст
Ответ на Re: How to setup default value "0000-00-00" for "date"  (Richard Huxton <dev@archonet.com>)
Список 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@cksoft.de
CK Software GmbH                        http://www.cksoft.de/
Phone: +49 7452 889 135                 Fax: +49 7452 889 136

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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: need help
Следующее
От: Michal Taborsky
Дата:
Сообщение: Re: How to setup default value "0000-00-00" for "date"