Overflow from PostgreSQL numeric type
Posted: Wed 09 Jul 2008 18:53
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
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