Wrong data type conversion on postgresql

I am stucked for now. I use the following: Delphi 2010, RemObjects and PostgreSQL.

All work fine but: I have some fields declared as numeric(20,0) and I expect that these columns data type to be datDecimal (ftFmtBcd or ftBcd). Instead of I get datFloat (ftFloat). The values has more than 15 digits, and the result that I get is converted to float using character “E” in decimals.

In application server, I build the schema dynamically at runtime. The problem seem to be the schema get wrong NativeFieldType (ftFloat instead of ftFmtBcd / ftBcd). Later, I change the field type in schema to ftFMTBcd, but the value still remains as float (because when I open the table, the values are formatted as native fields data types are).

Any suggestion(s), please?

what db driver you are using (ADO, AnyDAC, PgDAC, PostgresDAC, UniDAC, ZEOS, etc)?

Zeos.

Thanks, logged as bugs://75199

I can’t reproduce original problem with Delphi XE7 and ZEOS, so I can assume, that this was a bug in delphi itself.


this type (numeric(20,0)) is detected by DA as LargeInt. this is incorrect.

as a workaround, pls update uDAPostgresInterfaces.pas:

function PostgresDataTypeToDA(aDataType: string; Unicode: Boolean;ADecPrec, ADecScale: integer; aTypcategory: string): TDADataType;
...
    else if (aDataType = 'decimal') or (aDataType = 'numeric') then begin
      if (ADecScale = 0) and (ADecPrec < 19) then begin //changed

after this recompile ..\Data Abstract for Delphi\Source\Drivers\DAZeosDrv.dpr and put it near to DASchemaModeler7.exe. as a result, numeric(20,0) will be detected as datDecimal instead of datLargeInt

I assume, you are using the latest release.

this won’t change behavior, that ZEOS interprets numeric(20,0) as ftFloat as a result, the latest digits are lost and set to zero (12345678900123456789 -> 98765432100123500000)

bugs://75199 got closed with status fixed.

Logged as bugs://i63197.

bugs://i63197 was closed as fixed.