Page 1 of 1

Overflow from PostgreSQL numeric type

Posted: Wed 09 Jul 2008 18:53
by EvanStein
Hi.

I've just experienced an overflow while dereferencing a DataReader. Apparently the value was too large for C# type Decimal. The column was a PostgreSQL numeric, and the value had infinitely repeating decimal places (it was something like 2/3).

I worked around this by using the round() function in the query, to specify the maximum number of decimal places. However, I'm wondering whether there's some neater way to do this.

I'm also wondering whether is it correct for the DataReader to throw an exception when encountering a value like this.

I'd be grateful for any insights!

Thanks,
Evan

Posted: Tue 15 Jul 2008 10:01
by AndreyR
Hello, Evan.

Thank you for the bug report, the issue will be fixed.
But the situation is quite involved, and no timeframe is available.
As a temporary solution, you can keep using round() function.

Regards, Andrey.

Posted: Tue 15 Jul 2008 11:57
by EvanStein
Thanks, Andrey.

I don't remember this clearly, but I did encounter something similar using the Oracle .NET provider. They might have even told us that the behaviour was correct!

Sorry to cause you grief, though in the end, an already-strong product will be even stronger. Best of luck with your work.

Regards,
Evan