numeric_to_number() function skipping some digits

From: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: numeric_to_number() function skipping some digits
Date: 2009-09-18 09:47:48
Message-ID: be46a4f30909180247p542b2b46ya260d51e84df51a0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 string
is processed according to the number format. Which means, when 'G' is found
in the format we have moved the number pointer to next character. This is
why the digit '7' is skipped. And while processing ',', as it is not a digit
it is ignored.

Is this expected behaviour? or a bug?

Thanks

--
Jeevan B Chalke
EnterpriseDB Software India Private Limited, Pune
Visit us at: www.enterprisedb.com
---
If better is possible, then good is not enough

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2009-09-18 09:51:51 Re: Streaming Replication patch for CommitFest 2009-09
Previous Message Heikki Linnakangas 2009-09-18 08:01:35 Re: Feedback on getting rid of VACUUM FULL