corteza icon indicating copy to clipboard operation
corteza copied to clipboard

Number precision ignored when encoding number as column or alias

Open martkaczmarek opened this issue 1 year ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version of Corteza

2023.9.2

Current Behavior

When creating a number field with precision 3 for example, and encoding it as a column and not JSON field, the column created in SQL Server database is always of default type decimal(18,0). That means 18 decimal digits are stored, but 0 precision digits (no digits after comma). This is what application uses to add a column:

ALTER TABLE "tableName" ADD "columnName" DECIMAL

Expected Behavior

The solution is to use type decimal(18,n), where n is precision specified in module field configuration in Corteza:

ALTER TABLE "tableName" ADD "columnName" DECIMAL(18,6)

Steps To Reproduce

  1. Create namespace
  2. Create module with numerical field, precision 3; store it as a column in MSSQL database
  3. Table is created with decimal(18,0) column, instead of decimal(18,3)

Environment and versions

Corteza 2023.9.2 Docker install
SQL Server 2019

Anything else?

No response

martkaczmarek avatar Jan 23 '24 19:01 martkaczmarek

On a second thought, there may be a quick and dirty way to do this - just use 6 as precision value every time.

martkaczmarek avatar Feb 07 '24 14:02 martkaczmarek

Stale issue message

github-actions[bot] avatar Apr 08 '24 06:04 github-actions[bot]

No stale

martkaczmarek avatar Apr 10 '24 09:04 martkaczmarek

Stale issue message

github-actions[bot] avatar Jun 10 '24 06:06 github-actions[bot]