Re: [HACKERS] Range Types, discrete and/or continuous

2010-11-01 Thread Dimitri Fontaine
Kevin Grittner kevin.gritt...@wicourts.gov writes: Would you be comfortable writing that '012[3-5]' range as '[0123, 0126)' or something similar? What benefits do you see to using a range for prefixes versus a regular expression? Your proposed syntax would do fine, sure. Something like this

Re: [HACKERS] Range Types, discrete and/or continuous

2010-11-01 Thread Jeff Davis
On Mon, 2010-11-01 at 20:36 +0100, Dimitri Fontaine wrote: Kevin Grittner kevin.gritt...@wicourts.gov writes: Would you be comfortable writing that '012[3-5]' range as '[0123, 0126)' or something similar? What benefits do you see to using a range for prefixes versus a regular expression?

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-31 Thread Dimitri Fontaine
Jeff Davis pg...@j-davis.com writes: Also, there's a good case for continuous ranges for types like NUMERIC, but still continuous ranges don't seem quite as important overall. Well it seems to me that the prefix_range type is continuous, so I would tend to disagree here :) A prefix_range is

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-26 Thread Hitoshi Harada
2010/10/26 Robert Haas robertmh...@gmail.com: On Mon, Oct 25, 2010 at 8:13 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 18:03 -0400, Robert Haas wrote: Hmm.  Do you have some concrete examples of cases where a range type might want to do some representational optimization?

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-26 Thread Jeff Davis
On Mon, 2010-10-25 at 21:07 -0400, Robert Haas wrote: See, that gets complicated, because now you're restricting the range of values that can be expressed by the range type to something less than the natural range of the data type. I am not sure the value of supporting that is sufficient to

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-26 Thread Robert Haas
On Tue, Oct 26, 2010 at 1:26 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 21:07 -0400, Robert Haas wrote: See, that gets complicated, because now you're restricting the range of values that can be expressed by the range type to something less than the natural range of the data

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-26 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Tue, Oct 26, 2010 at 1:26 PM, Jeff Davis pg...@j-davis.com wrote: However, this is orthogonal, I think. I can always ask the user to specify everything when creating a Range Type, and then we can make them default to use the interface functions

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-26 Thread Robert Haas
On Tue, Oct 26, 2010 at 1:42 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Tue, Oct 26, 2010 at 1:26 PM, Jeff Davis pg...@j-davis.com wrote: However, this is orthogonal, I think. I can always ask the user to specify everything when creating a Range Type,

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread David Fetter
On Sun, Oct 24, 2010 at 06:59:34PM -0400, Tom Lane wrote: Jeff Davis pg...@j-davis.com writes: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) = [1,4] ) or continuous or both. Put me in the camp that says

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Heikki Linnakangas
On 25.10.2010 01:59, Tom Lane wrote: Jeff Davispg...@j-davis.com writes: If we treat those as discrete, then R1 = R2, R1 contains R2, R2 contains R1, and R2 - R1 = R1 - R2 = empty. However, if we treat those as continuous, then we get a contradiction: R2 contains R1 R1 does not contain R2

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Tom Lane
David Fetter da...@fetter.org writes: On Sun, Oct 24, 2010 at 06:59:34PM -0400, Tom Lane wrote: Put me in the camp that says you need both. I really seriously dislike the idea of representing [1, 2) as [1, 2-epsilon], mainly because there is often no portable value for epsilon.

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread David Fetter
On Mon, Oct 25, 2010 at 10:21:49AM -0400, Tom Lane wrote: David Fetter da...@fetter.org writes: On Sun, Oct 24, 2010 at 06:59:34PM -0400, Tom Lane wrote: Put me in the camp that says you need both. I really seriously dislike the idea of representing [1, 2) as [1, 2-epsilon], mainly

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Sun, 2010-10-24 at 18:59 -0400, Tom Lane wrote: Jeff Davis pg...@j-davis.com writes: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) = [1,4] ) or continuous or both. Put me in the camp that says you need

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 12:51 PM, Jeff Davis pg...@j-davis.com wrote: On Sun, 2010-10-24 at 18:59 -0400, Tom Lane wrote: Jeff Davis pg...@j-davis.com writes: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) =

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Kevin Grittner
Jeff Davis pg...@j-davis.com wrote: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) = [1,4] ) or continuous or both. I think that discrete ranges are required. For instance, day range and IP address ranges

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Mon, 2010-10-25 at 12:20 -0500, Kevin Grittner wrote: It would be very useful to be able to specify a granularity -- for example timestamps with a five minute granularity would be useful for scheduling appointments. In some cases the granularity might be inferred -- if we have a domain

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 2:01 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 12:20 -0500, Kevin Grittner wrote: It would be very useful to be able to specify a granularity -- for example timestamps with a five minute granularity would be useful for scheduling appointments. In

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Mon, 2010-10-25 at 13:00 -0400, Robert Haas wrote: I'm still confused. It seems to me (and maybe I'm full of it) that the distinction between continuous ranges and discrete ranges is pretty minor. Suppose you have continuous ranges done, and working. The only thing you need to add for

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Mon, 2010-10-25 at 14:11 -0400, Robert Haas wrote: On Mon, Oct 25, 2010 at 2:01 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 12:20 -0500, Kevin Grittner wrote: It would be very useful to be able to specify a granularity -- for example timestamps with a five minute

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 2:27 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 13:00 -0400, Robert Haas wrote: I'm still confused.  It seems to me (and maybe I'm full of it) that the distinction between continuous ranges and discrete ranges is pretty minor.  Suppose you have

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 2:44 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 14:11 -0400, Robert Haas wrote: On Mon, Oct 25, 2010 at 2:01 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 12:20 -0500, Kevin Grittner wrote: It would be very useful to be able to

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Mon, 2010-10-25 at 18:28 -0400, Robert Haas wrote: Oh, maybe I'm confused. Are you saying you'd need multiple copies of the base type, or multiple range types based on a single base type? The latter. That is, if you want a timestamp range with granularity 1 second, and a timestamp range

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Jeff Davis
On Mon, 2010-10-25 at 18:03 -0400, Robert Haas wrote: Hmm. Do you have some concrete examples of cases where a range type might want to do some representational optimization? Let's say for instance you want to keep an timestamp range in 16 bytes. You could have an 8-byte timestamp, a 7-byte

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 8:01 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 18:28 -0400, Robert Haas wrote: Oh, maybe I'm confused.  Are you saying you'd need multiple copies of the base type, or multiple range types based on a single base type? The latter. That is, if you want

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-25 Thread Robert Haas
On Mon, Oct 25, 2010 at 8:13 PM, Jeff Davis pg...@j-davis.com wrote: On Mon, 2010-10-25 at 18:03 -0400, Robert Haas wrote: Hmm.  Do you have some concrete examples of cases where a range type might want to do some representational optimization? Let's say for instance you want to keep an

[HACKERS] Range Types, discrete and/or continuous

2010-10-24 Thread Jeff Davis
I'd like to open the discussion for Range Types again. This is a fairly long email because several issues are intertwined, and I don't think they can be neatly pulled apart. Previous discussions: http://archives.postgresql.org/pgsql-hackers/2009-12/msg01162.php

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-24 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) = [1,4] ) or continuous or both. Put me in the camp that says you need both. I really seriously dislike the idea of

Re: [HACKERS] Range Types, discrete and/or continuous

2010-10-24 Thread Robert Haas
On Sun, Oct 24, 2010 at 6:59 PM, Tom Lane t...@sss.pgh.pa.us wrote: Jeff Davis pg...@j-davis.com writes: Last development cycle, one of the questions that was unresolved was whether to handle ranges like a discrete set (that is, [1,5) = [1,4] ) or continuous or both. Put me in the camp that