pashagolub / postgresdac

Delphi/C++Builder direct access components for PostgreSQL (and derivatives)
MIT License
19 stars 12 forks source link

BDETOPSQLStr makes a incorrect declaration of NUMERIC datatype for fields of type ftBcd #18

Closed macc2010 closed 5 months ago

macc2010 commented 7 months ago

Hello,

I do not know if I am incurring in an error, but I do see an incorrect declaration of the NUMERIC data type in function BDETOPSQLStr(Field : TFieldDef): String

When the DataType of the Field is ftBcd, if I have a Size ( digits after decimal point of 4 ) and a Precision of 15, the BDETOPSQLStr declares the field as : NUMERIC(4,15)

If I go to https://www.postgresql.org/docs/current/datatype-numeric.html I can see an example of NUMERIC( precision, scale ):

 "the number 23.5141 has a precision of 6 and a scale of 4"

But BDETOPSQLStr returns : NUMERIC(4,15) instead of NUMERIC(15, 4)

If you see in Delphi help : https://docwiki.embarcadero.com/Libraries/Sydney/en/Data.DB.TBCDField.Size

It says that the size in a TBcdField is :

   "Size is the number of digits after the decimal place"

So there is an incongruency in the definition

Thank you

pashagolub commented 6 months ago

Would you please provide a code snippet showing this issue?

Thanks in advance!