aces/Loris

Numeric LINST types without json data enabled can not save decimals

driusan opened this issue · 0 comments

Both the generate_tables_sql_and_testNames.php and generate_tables_sql.php scripts do some conversions between LINST types and if none, pass through the type from LINST to MariaDB/SQL in the create table script as the field type. Since numeric fields do not have special handling, a line like numeric{@}foo{@}...options.. gets passed through as

CREATE TABLE (
   ...
   foo numeric,
   ...
)

The numeric data type in MySQL/MariaDB defaults to decimal(10,0) (that is, a 10 digit long decimal with no digits after the decimal.) (See: https://dev.mysql.com/doc/refman/8.0/en/precision-math-decimal-characteristics.html). This means that even though LINST goes through effort to cast to double unless JSON data is enabled, the database server will eat any precision after the decimal by default.