Re: [HACKERS] numeric_to_number() function skipping some digits

2010-02-22 Thread Bruce Momjian
Added to TODO: |Fix to_number() handling for values not matching the format string --- Jeevan Chalke wrote: > Hi, > > On Mon, Sep 21, 2009 at 12:36 PM, Brendan Jurd wrote: > > > 2009/9/21 Jeevan Chalke : > > >

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-30 Thread Kevin Grittner
"Joshua D. Drake" wrote: > On Wed, 2009-09-30 at 19:08 -0500, Kevin Grittner wrote: >> I don't currently have access to an Oracle database > Just download developer edition? [quick google search] Looks like that would do it. Thanks. -Kevin -- Sent via pgsql-hackers mailing list (pgsq

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-30 Thread Joshua D. Drake
On Wed, 2009-09-30 at 19:08 -0500, Kevin Grittner wrote: > Tom Lane wrote: > > "Kevin Grittner" writes: > >> daveg wrote: > >>> On Tue, Sep 22, 2009 at 10:27:19AM +0530, Jeevan Chalke wrote: > It seems that Oracle reads formatting string from right-to-left. > > > >>> It seems worse to to

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-30 Thread Kevin Grittner
Tom Lane wrote: > "Kevin Grittner" writes: >> daveg wrote: >>> On Tue, Sep 22, 2009 at 10:27:19AM +0530, Jeevan Chalke wrote: It seems that Oracle reads formatting string from right-to-left. > >>> It seems worse to to give a wrong answer silently then to throw an >>> error. What we do n

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-30 Thread Tom Lane
"Kevin Grittner" writes: > daveg wrote: >> On Tue, Sep 22, 2009 at 10:27:19AM +0530, Jeevan Chalke wrote: >>> It seems that Oracle reads formatting string from right-to-left. >> It seems worse to to give a wrong answer silently then to throw an >> error. What we do now seems sort of MySqlish.

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-30 Thread Kevin Grittner
daveg wrote: > On Tue, Sep 22, 2009 at 10:27:19AM +0530, Jeevan Chalke wrote: >> >> It seems that Oracle reads formatting string from right-to-left. >> Here are few results: >> ('number','format') ==> Oracle PG >> >> ('34,50','999,99') ==> 3

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-23 Thread daveg
On Tue, Sep 22, 2009 at 10:27:19AM +0530, Jeevan Chalke wrote: > > It seems that Oracle reads formatting string from right-to-left. Here are > few results: > ('number','format') ==> Oracle PG > > ('34,50','999,99') ==> 3450340 > ('

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-22 Thread Euler Taveira de Oliveira
Jeevan Chalke escreveu: > That means we cannot simply ignore such characters from the input. > Rather we can process the string R-L. But yes this will definitely going > to break the current applications running today. > IIRC we tight the to_char() and to_timestamp() input for 8.4. Why don't we do

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-21 Thread Jeevan Chalke
Hi, On Mon, Sep 21, 2009 at 12:36 PM, Brendan Jurd wrote: > 2009/9/21 Jeevan Chalke : > > Oracle returns "19-SEP-09" irrespective of the format. > > Here in PG, we have getting the proper date irrespective of the format as > > Oracle. But in the case to to_number the returned value is wrong. For

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-21 Thread Brendan Jurd
2009/9/21 Brendan Jurd : > > # SELECT regexp_replace('34,50', E'[\\d.]', '', 'g')::numeric; > 3450 > Sorry, that regex ought to have read E'[^\\d.]'. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgs

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-21 Thread Brendan Jurd
2009/9/21 Jeevan Chalke : > Oracle returns "19-SEP-09" irrespective of the format. > Here in PG, we have getting the proper date irrespective of the format as > Oracle. But in the case to to_number the returned value is wrong. For > example following query returns '340' on PG where as it returns '3

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-20 Thread Jeevan Chalke
Hi, On Sat, Sep 19, 2009 at 1:52 AM, Brendan Jurd wrote: > 2009/9/19 Tom Lane : > > Should we have it throw an error if the input corresponding to a G > > symbol doesn't match the expected group separator? I'm concerned that > > that would break applications that work okay today. > > > > It wou

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-18 Thread Brendan Jurd
2009/9/19 Tom Lane : > Should we have it throw an error if the input corresponding to a G > symbol doesn't match the expected group separator?  I'm concerned that > that would break applications that work okay today. > It would be a substantial change to the behaviour, and to do it properly we'd h

Re: [HACKERS] numeric_to_number() function skipping some digits

2009-09-18 Thread Tom Lane
Jeevan Chalke writes: > With PG84, I have tried something like this which seem incorrect to me. > # SELECT '' AS to_number_2, to_number('-347,58', '99G999'); Well, the input doesn't actually match the format, so I'm not totally excited about this. You do get sane results from: regression=# se

[HACKERS] numeric_to_number() function skipping some digits

2009-09-18 Thread Jeevan Chalke
Hi, With PG84, I have tried something like this which seem incorrect to me. # SELECT '' AS to_number_2, to_number('-347,58', '99G999'); to_number_2 | to_number -+--- | -3458 (1 row) After browsing the code (numeric_to_number), I have found that number strin