Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZMji-0000hr-Lt for pgsql-bugs@arkaria.postgresql.org; Mon, 06 May 2013 14:49:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UZMji-00055f-6f for pgsql-bugs@arkaria.postgresql.org; Mon, 06 May 2013 14:49:54 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZMjh-00055a-IB for pgsql-bugs@postgresql.org; Mon, 06 May 2013 14:49:53 +0000 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UZMje-0007ss-KE for pgsql-bugs@postgresql.org; Mon, 06 May 2013 14:49:52 +0000 Received: by mail-wg0-f46.google.com with SMTP id n12so3523676wgh.1 for ; Mon, 06 May 2013 07:49:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding:x-gm-message-state; bh=Jk1J+4F12sFYTqLv2Jhd7OlYvWy1YmJan4QcZ7WJreI=; b=Zrac+1hOcsZwYTRTxDsUU0W8wxMTHEJdf9vRs+QU2FAbI9OfX1Y6STbnnVBE+16jIU cTOcZ+l45plnn9D4oH/gfWgsjfDyQkG/SDTGAPEhe1hXElXvuild+CSKTp+5z0MUJtaS vFYVFQCPZmC2yfT29mXqSg8vQ8AYMP/gG6iqhSR5LhzBRYh4eC1WdALtH3AZud4QxX53 GRs4464rZDtOJ5c6gTbQS8lmYW13m7lX+uE8KQFPUzLQC2UC6+wWPT3+gutnGoc16I+2 t5DGeN8e/SVALMRPw9Zetjh3jTyliDqx/ym2kXdUzSYaEO0yZqcNspdrwwDVy551MtC9 dJ/A== X-Received: by 10.180.21.242 with SMTP id y18mr9225020wie.7.1367851789450; Mon, 06 May 2013 07:49:49 -0700 (PDT) Received: from ?IPv6:2a00:fac0:0:a000:61bc:118e:353a:eb66? ([2a00:fac0:0:a000:61bc:118e:353a:eb66]) by mx.google.com with ESMTPSA id x13sm15758639wib.3.2013.05.06.07.49.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 May 2013 07:49:48 -0700 (PDT) Message-ID: <5187C2FE.9000305@fooby.de> Date: Mon, 06 May 2013 16:49:34 +0200 From: Patryk Kordylewski User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: Inconsistency between TO_CHAR() and TO_NUMBER() References: <51878292.6080003@fooby.de> <14272.1367850378@sss.pgh.pa.us> In-Reply-To: <14272.1367850378@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQlJRcq56ERwyqprWZSloBNO5owRDy0T/jsYU8k0ASvKP4x0MSx3itIiNiASb7jO5kvefkd2 X-Pg-Spam-Score: -1.2 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Am 06.05.2013 16:26, schrieb Tom Lane: > Patryk Kordylewski writes: >> Hi, >> i have the following test-case: > >> http://psql.privatepaste.com/b3b431851a > > Just for the record: this is a completely unacceptable method of > submitting a bug report. After a month from now, when that paste has > expired, nobody looking at the PG archives will have any way to find out > what you were talking about. Even without the archival consideration, > you've added an extra step to fetch the test case for anyone reading > your mail. > > Having said that, though, this does look wrong ... > > regards, tom lane Hmpf, you're right. I'm sorry. Here is the test-case: PostgreSQL 9.2.4 (also tested on 9.1 and 8.2) ### WORKS SET lc_numeric TO 'en_US.UTF-8'; SET SELECT TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), TO_NUMBER(TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), 'FM99G999G999G999G999G999G999D000'); to_char | to_number -----------------+--------------- 123,456,789.123 | 123456789.123 (1 row) ### DOES NOT WORK SET lc_numeric TO 'de_DE.UTF-8'; SET SELECT TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), TO_NUMBER(TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), 'FM99G999G999G999G999G999G999D000'); to_char | to_number -----------------+----------- 123.456.789,123 | 123.456 (1 row) ### FORMAT STRING WITHOUT FM PREFIX AND EXACT NUMBER OF DIGITS WORKS SELECT TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), TO_NUMBER(TO_CHAR(123456789.123, 'FM99G999G999G999G999G999G999D000'), '999G999G999D000'); to_char | to_number -----------------+--------------- 123.456.789,123 | 123456789.123 (1 row) Thank you. Best regards, Patryk -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs