Itgenase308: The platform vendor-specific driver can not handle the value returned for the column XXX of data type 'numeric'

With Query Tool Beta 20.1.327, I found a datatype issue with the PostgreSQL connector.
I don’t know whether this could be of any interest for Invantive to find a workaround or not. I fell this is due outside of Query Tool, by the driver for PostgreSQL itself but I’m unsure.

The error message says:

itgenase308: the platform vendor-specific driver can not handle the value returned for the column XXX of data type ‘numeric’

This occurs when doing a simple:

select id
,      amount 
from   table@PostGre

The PostgreSQL amount data type is NUMERIC, with (scale, precision) : (NULL, NULL).
PostGre says:

without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision. A column of this kind will not coerce input values to any particular scale, whereas numeric columns with a declared scale will coerce input values to that scale. (The SQL standard requires a default scale of 0, i.e., coercion to integer precision. We find this a bit useless. If you’re concerned about portability, always specify the precision and scale explicitly.)

so indeed a data type with no scale nor precision is allowed, bad news :frowning:

In some of my records I had an amount with a value as high as 0,000000000000007105427357601 which I agree is near 0, but not exactly. In that specific case, the SQL engine raises the itgenase308 error.

Bad is that the error message does not says which specific record throws the exception, but I found it within my 500K records :slight_smile:.

This error itgenase308 on PostgreSQL for numbers with many digits is a documented limitation of an underlying driver provided by the PostgreSQL. The current status we know about this limitation of the .NET driver for PostgreSQL is documented in the npgsql issue #2254.

You might want to consider the workaround as described on Numeric value does not fit in a System.Decimal · Issue #438 · npgsql/efcore.pg · GitHub. However, please apply with caution when applying since there is a risk of data corruption.