Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id EE1FBB5DCD6 for ; Sat, 29 Oct 2011 09:10:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 62723-01-4 for ; Sat, 29 Oct 2011 12:10:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 5B577B5DCC6 for ; Sat, 29 Oct 2011 09:10:18 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p9TCAHeu041758 for ; Sat, 29 Oct 2011 12:10:17 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p9TCAHBA041757; Sat, 29 Oct 2011 12:10:17 GMT (envelope-from www) Date: Sat, 29 Oct 2011 12:10:17 GMT Message-Id: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6277: Money datatype conversion wrong with Russian locale From: "Alexander LAW" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201110/297 X-Sequence-Number: 31567 The following bug has been logged online: Bug reference: 6277 Logged by: Alexander LAW Email address: exclusion@gmail.com PostgreSQL version: 9.1.1 Operating system: Windows Description: Money datatype conversion wrong with Russian locale Details: When lc_monetary is set to Russian, money values having 4+ digits formatted incorrectly. E.g. following select: set lc_monetary='Russian'; select '1000'::money; returns a string that can't be displayed. It's caused by wrong mon_thousands_sep processing in backend/utils/adt/cash.c, cash_out function. The code assumes that the thousands separator fits in one character. But in Russian locale we have non-breakable space as the thousands separator (0xC2 0xA0 in UTF-8). The cash_out function uses only the first char (0xC2) of it and thus returns an invalid string: 1\xC2000.