Re: Another question about Range types

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Another question about Range types
Дата
Msg-id 022201cd71c8$bd9c08d0$38d41a70$@yahoo.com
обсуждение исходный текст
Ответ на Re: Another question about Range types  (Mike Christensen <mike@kitchenpc.com>)
Ответы Re: Another question about Range types  (Mike Christensen <mike@kitchenpc.com>)
Список pgsql-general
>
> If I do switch to RANGE types, I think [2,2] would make sense in this
case.
> Using unbounded ranges might make sense if I wanted to express something
> like "Use up to 1 cup of flour" or "You'll need at least 3 cups of water".
>

In these cases:

Flour: [0, 1] - "optional, but maximum of 1-cup";  you cannot supply a
negative amount of ingredient...
Water: [3, ) - "at least three cups, but remember you will have to pay the
water bill at some point..."

The water example implies some need to flag the quantity as needing an
explanation.  In this case I would probably say "[3,3]" and set a flag so
that you can describe, in words, those situations where additional water
would be OK.  Mabye some kind of "quantity_precision" flag with possible
values of [EXACT,APPROXIMATE,MINIMUM,MAXIMUM].  The reason I say this is
because the value of storing an amount as a value is that it can be used in
calculations and it is difficult to use infinity in calculations.  By
storing a finite range you can more readily use the values in calculations
and when you care about whether the value is "required" or "suggested" you
have a flag you can query to tell you which it is.

David J.




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

Предыдущее
От: "David Johnston"
Дата:
Сообщение: Re: strategies for segregating client data when using PostgreSQL in a web app
Следующее
От: Mike Christensen
Дата:
Сообщение: Re: Another question about Range types