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@crankycanuck.ca