Обсуждение: german decimal / locale

Поиск
Список
Период
Сортировка

german decimal / locale

От
VRoehl@t-online.de (Volker Roehl)
Дата:
How to perform an german-style numeric output like: '1.234,56' with psql?

I use the SuSE 8.0 standard RPM for postgresql:

postgresql-libs-7.2-70
postgresql-7.2-70
postgresql-docs-7.2-70
postgresql-odbc-7.2-70
postgresql-server-7.2-70
postgresql-tcl-7.2-70
postgresql-tk-7.2-70

This is my enviroment:

version:
========
psql (PostgreSQL) 7.2
contains support for: readline, history, multibyte
Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
Portions Copyright (c) 1996, Regents of the University of California
Read the file COPYRIGHT or use the command \copyright to see the
usage and distribution terms.

locale (for user and postgres):
===============================

user@laptop:~> locale

LANG=de_DE@euro
LC_CTYPE="de_DE@euro"
LC_NUMERIC="de_DE@euro"
LC_TIME="de_DE@euro"
LC_COLLATE=POSIX
LC_MONETARY="de_DE@euro"
LC_MESSAGES="de_DE@euro"
LC_PAPER="de_DE@euro"
LC_NAME="de_DE@euro"
LC_ADDRESS="de_DE@euro"
LC_TELEPHONE="de_DE@euro"
LC_MEASUREMENT="de_DE@euro"
LC_IDENTIFICATION="de_DE@euro"
LC_ALL=

postgres@laptop:~> locale

LANG=de_DE@euro
LC_CTYPE="de_DE@euro"
LC_NUMERIC="de_DE@euro"
LC_TIME="de_DE@euro"
LC_COLLATE=POSIX
LC_MONETARY="de_DE@euro"
LC_MESSAGES="de_DE@euro"
LC_PAPER="de_DE@euro"
LC_NAME="de_DE@euro"
LC_ADDRESS="de_DE@euro"
LC_TELEPHONE="de_DE@euro"
LC_MEASUREMENT="de_DE@euro"
LC_IDENTIFICATION="de_DE@euro"
LC_ALL=


encoding:
=========

        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 db1       | vroehl   | LATIN1
 db2       | vroehl   | LATIN1
 template0 | postgres | LATIN1
 template1 | postgres | LATIN1
(4 rows)

SHOW DateStyle:
===============

NOTICE:  DateStyle is German with European conventions
SHOW VARIABLE

Table with Numeric-Typ (price):
===============================

                 Table "kh"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 artbez | character varying(80) |
 artnum | character(8)          |
 laenge | integer               |
 br500  | numeric(6,2)          |

Select-Statement:
=================

select artbez,artnum,laenge,br500 from kh;

-[ RECORD 1 ]--------------------
artbez | Kaminhaube (Abdeckwelle)
artnum | 461.000
laenge | 500
br500  | 108.60

Problem:
========

The german correct output need a decimal comma, like "108,60".
The function to_char(br500, '9G990D00') return the same result: "108.60".