Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com> writes:
> Heikki Linnakangas wrote:
>> You don't need to custom type for that. A custom operator class with
>> custom comparison operators is enough.
> Ok, I tried with ordinary varchar and my own operators/op class. But than:
> 1) the index is never used (I created it 'with' my opclass)
> 2) the 'order by' doesn't care about my operator class, it's normal varchar sequence.
Yeah, because ORDER BY is still going to look to the default varchar
opclass to determine what the ordering is supposed to be. Assuming
your custom less-than operator is named <<<, you'd have to write
ORDER BY col USING <<<
to get this sort order.
If you want ORDER BY on the column to default to your custom ordering,
the only way is a distinct datatype that you can make your custom
opclass be the default for.
The domain idea might work, I'm not totally sure. Defining
functions/operators on a domain is a bit ticklish because anything but
an exact match will get smashed to the domain base type and thus not
match your function. I think though that in this case you might get
away with it because it would be an exact match --- it's worth a try
regards, tom lane
In response to
pgsql-hackers by date
|Next:||From: Stephen Frost||Date: 2007-06-28 17:01:44|
|Subject: 'SET LOCAL ROLE blah;' doesn't work?|
|Previous:||From: Bruce McAlister||Date: 2007-06-28 15:40:13|
|Subject: Re: AutoVacuum Behaviour Question|