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

Поиск
Список
Период
Сортировка
От Jim Wilson
Тема Re: How to setup default value "0000-00-00" for "date"
Дата
Msg-id twig.1093212062.19696@kelcomaine.com
обсуждение исходный текст
Ответ на Re: How to setup default value "0000-00-00" for "date"  (Harald Fuchs <hf0722x@protecting.net>)
Список pgsql-general
Harald Fuchs said:

> In article <twig.1093012692.59157@kelcomaine.com>,
> "Jim Wilson" <jimw@kelcomaine.com> writes:
>
> > It'd probably be better design to not use the date as a flag.  This issue
> > actually came up for me yesterday with an application that is now being ported
> > to Postgres.  Previously a null "ship date" indicated that an item to be
> > shipped had not gone yet.  I'm adding a flag, not just because of this issue
> > you describe,  but it is also more intuitive for anyone looking at the data
> > who is unfamiliar with the business logic.
>
> Me thinks that's somewhat unclean.  Is your shipDate nullable?  If
> yes, what's the meaning of "shipDate IS NULL"?  If no, what do you put
> in that field if notYetShipped is true?

Actually it would be a boolean "shipped" flag.  ShipDate can be whatever you
want.  Perhaps even null.  All in all it just makes sense to use the boolean
when you need a flag (or integer or char for more than two flag states).

Best,

Jim


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

Предыдущее
От: Thomas Hallgren
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions on