Thread:

From
amk@gmx.at
Date:
Hello Postgres Gurus!

In the German language we have special characters like
Ä (Ä), Ö (Ö), Ü (Ü), ß (ß) and so on.

I have 5 entries in a table "entries" with one varchar column "name":

select name from entries;
Birnen
Äpfel
Öl
Essig
Salz

I like to sort these entries by name:

select name from entries order by name;
Birnen
Essig
Salz
Äpfel
Öl

But instead of using the standard alphabet
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Ä Ö Ü ß
for sorting the strings I would like to use the German alphabet
A Ä B C D E F G H I J K L M N O Ö P Q R S ß T U Ü V W X Y Z
to get the correct (sorted by German alphabet) result:

this would be my preferred result: ==>
select name from entries order by name;
Äpfel
Birnen
Essig
Öl
Salz

Can I do this with PostgreSQL?

Thanks,
Alex

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net


Re:

From
Michael Meskes
Date:
On Mon, Jan 14, 2002 at 04:05:37PM +0100, amk@gmx.at wrote:
> Hello Postgres Gurus!
> ...
>
> this would be my preferred result: ==>
> select name from entries order by name;

How about:

mm=# select name from entries order by name;
  name
--------
 Äpfel
 Birnen
 Essig
 Öl
 Salz
(5 rows)

> Can I do this with PostgreSQL?

Sure, as the example above is copied from psql. :-)

Just make sure locale support is compiled into postgresql. That is, I
believe that's all. I cannot remember having to configure anything to get
this going.

Michael

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Re:

From
Holger Krug
Date:
On Tue, Jan 15, 2002 at 09:59:16AM +0100, Michael Meskes wrote:
> Just make sure locale support is compiled into postgresql. That is, I
> believe that's all. I cannot remember having to configure anything to get
> this going.

You have to have the correct LOCALE setting when you call
`initdb'. Just compiled in LOCALE support isn't enough.

Chapter 5 of PostgreSQL Administrator's Guide tells you all, what you
need.
--
Holger Krug
hkrug@rationalizer.com

Re:

From
Michael Meskes
Date:
On Tue, Jan 15, 2002 at 10:17:40AM +0100, Holger Krug wrote:
> You have to have the correct LOCALE setting when you call
> `initdb'. Just compiled in LOCALE support isn't enough.

Sure. But I just supposed that this is the case. :-)

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Re:

From
Jan Wieck
Date:
Michael Meskes wrote:
> On Tue, Jan 15, 2002 at 10:17:40AM +0100, Holger Krug wrote:
> > You have to have the correct LOCALE setting when you call
> > `initdb'. Just compiled in LOCALE support isn't enough.
>
> Sure. But I just supposed that this is the case. :-)

    Nice  assumption, but guess what, there are Germans out there
    who use en_US settings by default. And I used to even  before
    the move ...


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re:

From
Michael Meskes
Date:
On Tue, Jan 15, 2002 at 09:41:27AM -0500, Jan Wieck wrote:
> > Sure. But I just supposed that this is the case. :-)
>
>     Nice  assumption, but guess what, there are Germans out there
>     who use en_US settings by default. And I used to even  before
>     the move ...

Okay, accepted. :-)

Michael
--
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

Re: locale support (was Re: )

From
Holger Klawitter
Date:
> Just make sure locale support is compiled into postgresql. That is, I
> believe that's all. I cannot remember having to configure anything to get
> this going.

I vaguely remember having to initdb appropriately (option -E) when
switching from non locale to locale.

With kind regards / Mit freundlichem Gruß
    Holger Klawitter
--
Holger Klawitter
holger@klawitter.de                             http://www.klawitter.de