Hi everybody,
We have noticed that when importing a solution on the server. Columns which have been created with the FLOAT datatype in MS SQL Server are created by Servoy (during import) with the REAL datatype in PostgreSQL.
The problem is that FLOAT in MS SQL = 8 bytes and REAL in PostgreSQL = 4 bytes.
We moved recently to PostgreSQL and this is causing us a few problems as we use big decimal values. With REAL it rounds numbers to 6 significant figures.
We had to manually change the datatypes from REAL to DOUBLE PRECISION (8 bytes). By the way, FLOAT is also accepted in PostgreSQL queries (using PgAdmin).
Cheers.
Edit: I have changed again the datatype to NUMERIC(12,2). In Servoy when the datatype was FLOAT/DOUBLE PRECISION, the length of the number was ‘8’ (probably 8 bytes?!). But now it’s ‘12,2’. 12,2 bytes?!!
Foobrother,
Servoy chooses column types for each database for most of the types as defined by the hibernate library.
In case of floats in postgres, we use float4.
If you need other column types you need to create your own DDL and Servoy will work with these as existing columns.
Rob
Ok, I see ![Sad :(]()
And what about the length displayed in developer? What does it represent?
A numeric like (12,2) is 12 numbers before the comma and 2 after
so this is the largest number that then can be stored:
999999999999,99
for floats (single precision) there are 4 bytes and for double precisions 8 bytes are used for storage (in a floating point notation)
jcompagner:
A numeric like (12,2) is 12 numbers before the comma and 2 after
so this is the largest number that then can be stored:
999999999999,99
for floats (single precision) there are 4 bytes and for double precisions 8 bytes are used for storage (in a floating point notation)
I knew that. But do you mean that, in developer, when the type is Numeric the length displayed will be the number of numbers and when it is Float4 or Double Precision the length is the number of bytes?! ![Rolling Eyes :roll:]()
So the length displayed is not of the same type depending on the type of the datatype ![Question :?:]()
if you see for floating point numbers just (4) and not (10,2) then it is a real float in the db instead of a decimal/numeric
jcompagner:
if you see for floating point numbers just (4) and not (10,2) then it is a real float in the db instead of a decimal/numeric
Ok
It can be confusing to display the number of bytes instead of the number of numbers.
A future improvement could be to display the type used in the DBMS which is linked to the solution (e.g. FLOAT for MS SQL Server, DOUBLE PRECISION for PostgreSQL, etc…) ![Rolling Eyes :roll:]()