sign parsing (was: Re: [HACKERS] to_char/to_number loses sign)

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, List pgsql-patches <pgsql-patches(at)postgreSQL(dot)org>
Subject: sign parsing (was: Re: [HACKERS] to_char/to_number loses sign)
Date: 2004-10-27 11:59:38
Message-ID: 1098878378.19187.76.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Tue, 2004-10-26 at 13:27 -0400, Tom Lane wrote:
> Karel Zak <zakkr(at)zf(dot)jcu(dot)cz> writes:
> > Yes, you're right. It strange, but NUM_S missing there. The conversion
> > from string to number is less stable part of formatting.c...
>
> > The patch is in the attachment.
>
> This patch causes the regression tests to fail. I think you need to
> consider the to_char() side of it more carefully.

Sorry of this in beta version...

The problem was bigger than I expected. I hope it's fixed in actual
patch. All regression tests pass.

The patch changes two lines in regression test too. It's because old
version of to_number() allows to use wrong number input and this input
was in regression test. The call to_char(-0.01, ' 9 9 . 9 9 S'); never
produced ' . 0 1 -' but always ' . 0 1-' only.

-SELECT '' AS to_number_13, to_number(' . 0 1 -', ' 9 9 . 9 9 S');
+SELECT '' AS to_number_13, to_number(' . 0 1-', ' 9 9 . 9 9 S');
^^^
'S' = locale sign and it must be always anchored to last or first
number.

Again sorry,
Karel

--
Karel Zak
http://home.zf.jcu.cz/~zakkr

Attachment Content-Type Size
pgsql-formatting-10272004.patch.gz application/x-gzip 2.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2004-10-27 14:02:17 Re: rmtree() failure on Windows
Previous Message ohp 2004-10-27 11:01:45 Re: Unixware 714 pthreads

Browse pgsql-patches by date

  From Date Subject
Next Message Reini Urban 2004-10-27 12:30:26 contrib/tsearch2 missing LIBS
Previous Message Neil Conway 2004-10-27 11:52:57 Re: port/ build fix