Re: WIP patch: Collation support - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: WIP patch: Collation support
Date
Msg-id 20080910102334.GC27812@svana.org
Whole thread Raw
In response to Re: WIP patch: Collation support  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: WIP patch: Collation support  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
On Wed, Sep 10, 2008 at 12:51:02PM +0300, Heikki Linnakangas wrote:
> >Since the set of collations isn't exactly denumerable, we need some way
> >to allow the user to specify the collation they want. The only
> >collation PostgreSQL knows about is the C collation. Anything else is
> >user-defined.
>
> Let's just use the name of the OS locale, like we do now. Having a
> pg_collation catalog just moves the problem elsewhere: we'd still need
> something in pg_collation to tie the collation to the OS locale.

There's not a one-to-one mapping between collation and locale name. A
locale name includes information about the charset and a collation may
have paramters like case-sensetivity and pad-attribute which are not
present in the locale name. You need a mapping anyway, which is what
this table is for.

The difference in collation between CHAR() and VARCHAR() is the usual
example here.

> >Long term, the collation is a property of the type, ...
>
> I'm not sure what the SQL spec says about that, but I believe it
> provides syntax and rules for all that.

The spec is quite detailed about and I posted code to do it years ago.
The point is that we don't need to go that far with this patch.

> >But that put us back where we started: every database having the same
> >collation. We're trying to move away from that. Just reindex everything
> >and be done with it.
>
> That's easier said than done, unfortunately.

I don't see an alternative.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Synchronous Log Shipping Replication
Next
From: Zdenek Kotala
Date:
Subject: using hash index when BETWEEN is specified