Re: Range Types, constructors, and the type system - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Range Types, constructors, and the type system
Date
Msg-id CFF6B5E9-66D7-4E78-B580-8E98E5F632D7@phlo.org
Whole thread Raw
In response to Re: Range Types, constructors, and the type system  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Range Types, constructors, and the type system
List pgsql-hackers
On Jun29, 2011, at 23:44 , Peter Eisentraut wrote:
> On ons, 2011-06-29 at 10:15 -0700, David E. Wheeler wrote:
>> On Jun 29, 2011, at 10:13 AM, Florian Pflug wrote:
>>> Because there might be more than one range type for a
>>> base type. Say there are two range types over text, one
>>> with collation 'de_DE' and one with collation 'en_US'.
>>> What would the type of
>>> range('foo', 'foooo')
>>> be?
>> 
>> The one that corresponds to the current LC_COLLATE setting.
> 
> Yes, or more generally, we have logic that determines, for example, what
> collation to use for
> 
> 'foo' < 'foooo'
> 
> The same logic can be used to determine what collation to use for
> 
> range('foo', 'foooo')
> 
> (In fact, if you implement range() as a user-space function, that will
> happen automatically.)

I don't think it will - as it stands, there isn't a single collatable
type RANGE but instead one *distinct* type per combination of base type,
btree opclass and collation. The reasons for that were discussed at length -
the basic argument for doing it that way was to make a range represent
a fixed set of values.

There's also no guarantee that a range type with collation LC_COLLATE
even exists.

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Jun Ishiduka
Date:
Subject: Re: Online base backup from the hot-standby
Next
From: Florian Pflug
Date:
Subject: Re: Patch file questions?