a contrib function to query current locale values

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: a contrib function to query current locale values
Date: 2001-02-06 23:34:18
Message-ID: 3A8089FA.28977A26@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

I've written a small function that should go into contrib for 7.1

As locale issues are quite tricky, being able to find out what locale
backend thinks it is in is a good thing ;)

from my README.getlocale:

getlocale('category')
---------------------

return the locale setting of the backend
(see '> man setlocale for definitions)

If category is one of LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY,
LC_NUMERIC, LC_TIME the corresponding setting is returned.

[hannu(at)taru contrib]$ psql -c "select getlocale('LC_COLLATE')"
getlocale
-----------
en_US
(1 row)

for LC_ALL (and anything else) a string like the following is returned

[hannu(at)taru getlocale]$ psql -c "select getlocale('*')"
getlocale
----------------------------------------------------------------------------------------

LC_CTYPE=en_US;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=en_US;LC_MONETARY=en_US;LC_MESSAGES=C
(1 row)

IMHO some form of it should end up in the main distribution, probably by
7.2.

---------------------------------
Hannu Krosing <hannu(at)krosing(dot)net>

Attachment Content-Type Size
getlocale.tar.gz application/x-gzip 1.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-07 00:08:20 Re: OID from insert has extra letter
Previous Message Peter Eisentraut 2001-02-06 22:43:00 Re: psql: why not pset PROMPT[0-2] ?