Re: Very puzzling sort behavior

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Very puzzling sort behavior
Date: 2015-09-10 22:03:18
Message-ID: 20150910220317.GT28424@crankycanuck.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 10, 2015 at 02:54:31PM -0700, Ken Tanzer wrote:
> Thanks, but I guess I should have been clearer. Thanks to y'all wonderful
> mailing list folks, I get it now as to why the two sorts are not the same.
> I'm hoping for practical suggestions or advice about how to get C locale
> sorting without having to rewrite all my existing queries.

Why not change the collation for the column?
http://www.postgresql.org/docs/9.4/interactive/sql-altertable.html

> be clinging to futile hope, but is there really no way to specify a
> collation for the return value of a function?

I don't believe so. I think you need to specify the collation for the
data itself.

It strikes me that you might be able to similate this with a
materialized view or something like that, which has a different
collation than the source table. That seems like it'd be pretty
awkward, but if there's some reason you can't use C collation on the
source table itself that might work. I guess you could do the same
thing with a temporary table inside the function, thereby getting a
different collation on the data than in the source table. These both
seem like hacks, but if you need a bugfix prior to a real solution
they'd give you a path.

A

--
Andrew Sullivan
ajs(at)crankycanuck(dot)ca

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2015-09-10 22:49:43 Re: Very puzzling sort behavior
Previous Message Ken Tanzer 2015-09-10 21:54:31 Re: Very puzzling sort behavior