Re: PGSQL - FAQ 4.1

Started by Bruce Momjianabout 24 years ago5 messages
#1Bruce Momjian
pgman@candle.pha.pa.us

OK, can someone comment on this email I received. I am confused myself.
FAQ item 4.1 says:

4.1) Why is system confused about commas, decimal points, and date formats.

Does locale only control dates? If so, why the mention of commas? This
item was there before I started maintaining the FAQ.

---------------------------------------------------------------------------

Carsten Grewe wrote:

Hi Bruce!

Below you'll find a question I asked to the pgsql-general list. I
missunderstood FAQ 4.1. Maybe it's just me - maybe the answer to the FAQ is
irritating - it's for you to judge.

Kind regards and merry Christmas
Carsten

---------- forwarded message ----------

Subject: Re: [GENERAL] localization
Date: Fri, 21 Dec 2001 13:06:20 +0100
From: Carsten Grewe <DerReisende@schatzis.org>
To: Karel Zak <zakkr@zf.jcu.cz>

Karel Zak, Freitag, 21. Dezember 2001 10:09:

On Thu, Dec 20, 2001 at 10:24:31PM +0100, Carsten Grewe wrote:

I am a bit lost here. I have tried to convince pgsql to show numbers with
a decimal-comma (german style) instead of the decimal-point.

[snip]

The backend ignore LC_NUMERIC. If you want output numbers in locale
depend format use to_char() (for example to_char(1234.5, '9G999D9').

Karel

Thanks! I know about the Format Functions, but FAQ 4.1 made me believe that
there is a way to influence the backend.

VVVVVVVVV
4.1) Why is system confused about commas, decimal points, and date formats.

Check your locale configuration. PostgreSQL uses the locale setting of the
user that ran the postmaster process. There are postgres and psql SET
commands to control the date format. Set those accordingly for your operating
environment.
VVVVVVVVV

Kind regards and merry Christmas
Carsten

-------------------------------------------------------

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#2Thomas Lockhart
lockhart@fourpalms.org
In reply to: Bruce Momjian (#1)

OK, can someone comment on this email I received. I am confused myself.
FAQ item 4.1 says:

4.1) Why is system confused about commas, decimal points, and date formats.

Does locale only control dates? If so, why the mention of commas? This
item was there before I started maintaining the FAQ.

I think there is confusion on these things, but the FAQ content does not
seem to reduce it much. afaik locale settings affect *nothing* in
date/time, but SET DATESTYLE does. Is it the case that LC_NUMERIC or
other settings would affect numeric *input*?

- Thomas

Show quoted text

Carsten Grewe wrote:

Hi Bruce!

Below you'll find a question I asked to the pgsql-general list. I
missunderstood FAQ 4.1. Maybe it's just me - maybe the answer to the FAQ is
irritating - it's for you to judge.

Kind regards and merry Christmas
Carsten

---------- forwarded message ----------

Subject: Re: [GENERAL] localization
Date: Fri, 21 Dec 2001 13:06:20 +0100
From: Carsten Grewe <DerReisende@schatzis.org>
To: Karel Zak <zakkr@zf.jcu.cz>

Karel Zak, Freitag, 21. Dezember 2001 10:09:

On Thu, Dec 20, 2001 at 10:24:31PM +0100, Carsten Grewe wrote:

I am a bit lost here. I have tried to convince pgsql to show numbers with
a decimal-comma (german style) instead of the decimal-point.

[snip]

The backend ignore LC_NUMERIC. If you want output numbers in locale
depend format use to_char() (for example to_char(1234.5, '9G999D9').

Karel

Thanks! I know about the Format Functions, but FAQ 4.1 made me believe that
there is a way to influence the backend.

VVVVVVVVV
4.1) Why is system confused about commas, decimal points, and date formats.

Check your locale configuration. PostgreSQL uses the locale setting of the
user that ran the postmaster process. There are postgres and psql SET
commands to control the date format. Set those accordingly for your operating
environment.
VVVVVVVVV

Kind regards and merry Christmas
Carsten

-------------------------------------------------------

--
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 853-3000
+  If your life is a hard drive,     |  830 Blythe Avenue
+  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Thomas Lockhart (#2)

Thomas Lockhart <lockhart@fourpalms.org> writes:

Is it the case that LC_NUMERIC or
other settings would affect numeric *input*?

No, because we don't accept those settings from the environment;
if you look in main.c, you'll see that only LC_MESSAGES,
LC_CTYPE, LC_COLLATE, and LC_MONETARY are accepted.

to_char does look at additional locale settings, I believe, but in
general we ignore LC_NUMERIC.

regards, tom lane

#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Tom Lane (#3)

Tom Lane wrote:

Thomas Lockhart <lockhart@fourpalms.org> writes:

Is it the case that LC_NUMERIC or
other settings would affect numeric *input*?

No, because we don't accept those settings from the environment;
if you look in main.c, you'll see that only LC_MESSAGES,
LC_CTYPE, LC_COLLATE, and LC_MONETARY are accepted.

to_char does look at additional locale settings, I believe, but in
general we ignore LC_NUMERIC.

Seems I should just remove the FAQ item.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Bruce Momjian (#4)

Bruce Momjian wrote:

Tom Lane wrote:

Thomas Lockhart <lockhart@fourpalms.org> writes:

Is it the case that LC_NUMERIC or
other settings would affect numeric *input*?

No, because we don't accept those settings from the environment;
if you look in main.c, you'll see that only LC_MESSAGES,
LC_CTYPE, LC_COLLATE, and LC_MONETARY are accepted.

to_char does look at additional locale settings, I believe, but in
general we ignore LC_NUMERIC.

Seems I should just remove the FAQ item.

OK, I have removed the item. Seemed just too confusing.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026