Re: Removing SORTFUNC_LT/REVLT - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Removing SORTFUNC_LT/REVLT
Date
Msg-id 7077.1135871363@sss.pgh.pa.us
Whole thread Raw
In response to Re: Removing SORTFUNC_LT/REVLT  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Removing SORTFUNC_LT/REVLT  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Removing SORTFUNC_LT/REVLT  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> Hmm. By feature I assume you mean "ORDER BY ... USING" (which no-one
> could find an example of) and not "requiring the operator to be part of
> an opclass".

> In fact, I don't think we ever need to remove the syntax, just as long
> as the operator is part of an operator class, it'll be fine.

Well, no, that's not the problem: the problem is that you should be able
to specify ORDER BY any sort ordering that the system can deal with, and
the USING syntax is in fact too impoverished to do that.  What if the
mentioned operator is in more than one operator class?  I believe that
ATM the code makes a random choice of which opclass' sort function to
use, which pretty much sucks.

I haven't had time yet to digest the material you posted yesterday about
COLLATE.  Maybe there's a solution in there, but I think it could only
happen if we assume that every potential sort operator appears in only
one opclass.  Which seems like a pretty restrictive assumption, even
granted that COLLATE will start to carry some of the load of picking
different sorting options.

What I'd really like is to deprecate the "USING operator" syntax in
favor of a "USING operatorclassname" syntax.  Actually, "USING opclass
[ASC/DESC]" would get the job done, since given an opclass you can
certainly run the sort function either normal or reverse.

We could keep the "USING operator" syntax but insist that it's only
allowed if there's exactly one possible opclass mapping.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [Bizgres-general] WAL bypass for INSERT, UPDATE and
Next
From: Tom Lane
Date:
Subject: Re: localization problem (and solution)