From: | "David Johnston" <polobo(at)yahoo(dot)com> |
---|---|
To: | "'Mike Christensen'" <mike(at)kitchenpc(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Another question about Range types |
Date: | 2012-08-03 22:38:44 |
Message-ID: | 022201cd71c8$bd9c08d0$38d41a70$@yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Christensen | 2012-08-03 22:55:04 | Re: Another question about Range types |
Previous Message | David Johnston | 2012-08-03 22:25:36 | Re: strategies for segregating client data when using PostgreSQL in a web app |