#Numeric value does not fit in a System.Decimal

Hi EasyMorph Team,

I am using the PostGreSQL connector and I am trying to retrieve a column that is defined as “numeric(50,30)” and I am getting “#Numeric value does not fit in a System.Decimal” as the value in the EM table column. I can’t redefine the table column, so how can I get around this issue?

Thanks,

Keith

If you’re using the visual query builder, try creating an SQL expression that casts the column to one of the standard data types in Postgres. I’m not an expert in Postgres but something like below.

If you’re using the “Custom SQL” mode, then using a cast statement in the SQL query.

Hi Dmitri,

The select being used is select * from… as this routing is doing a table dump followed by some transformations and I need to take all columns and rows. The table has 55 columns and I really an trying to avoid having to specify all the columns in the select. While I can do this as a workaround, EasyMorph should really look at the precision needed for the incoming data and select an appropriate data type instead of just defaulting to “System.decimal”. Another option would be to allow the user to select a “Default data type” in the Advanced tab on the query builder for numeric data.

Keith

The problem is that in Windows (specifically, in .NET) there is no appropriate data type for NUMERIC(50,30). The required precision for this data type is 50+30 = 80 digits. The Decimal data type is encoded with 128 bits and provides the maximum possible precision which is 28-29 digits, far not enough to encode NUMERIC(50,30). Hence the error.

I suspect that your application doesn’t actually require 80 digit numbers. Probably, the actual precision is much less than that. But EasyMorph can’t (and shouldn’t) decide what precision is actually used and how the numbers can be truncated.

On second thought, we might need a separate action that would dump a database table into a text file as is without importing it in EasyMorph. That would provide more flexibility in dealing with data type issues.

That would be perfect as that is what I am trying to do… dump a bunch of tables to csv.