Search Postgresql Archives

Re: Another question about Range types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 
> 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.




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux