Numeric Precision is not set correctly in postgresql

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Numeric Precision is not set correctly in postgresql

Post by OutOfTouch6947 » Tue 31 Jan 2017 21:37

Hi,

I have been using a model first approach and I don't know what I need to do to set precision and scale in the database from the model, nothing I have tried works other than to set the precision and scale in the database and than update the model.

Here is an example of the script I ran to set the precision and scale in the database

Code: Select all

ALTER TABLE "TaxRatesMNVA" ALTER COLUMN "TaxRate" SET DATA TYPE NUMERIC(28,10);
I am using EntityDeveloper and dotConnect for postgresql.

Shalex
Site Admin
Posts: 8241
Joined: Thu 14 Aug 2008 12:44

Re: Numeric Precision is not set correctly in postgresql

Post by Shalex » Wed 01 Feb 2017 16:11

You are working with LinqConnect Model (*.lqml), aren't you?
OutOfTouch6947 wrote:I don't know what I need to do to set precision and scale in the database from the model
Please double click the required property in Model Explorer (or on diagram) to open Property Editor and set Server Data Type to data type with precision and scale: numeric(28,10) instead of just numeric.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: Numeric Precision is not set correctly in postgresql

Post by OutOfTouch6947 » Wed 01 Feb 2017 18:51

Yes I am using the LinqConnect for postgresql model.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: Numeric Precision is not set correctly in postgresql

Post by OutOfTouch6947 » Wed 01 Feb 2017 18:59

Shalex wrote:You are working with LinqConnect Model (*.lqml), aren't you?
OutOfTouch6947 wrote:I don't know what I need to do to set precision and scale in the database from the model
Please double click the required property in Model Explorer (or on diagram) to open Property Editor and set Server Data Type to data type with precision and scale: numeric(28,10) instead of just numeric.
Already tried what you suggested here before I created my ticket, please try to reproduce on your end or double check that this functions correctly. After doing this and updating the database using the model and checking the database I can clearly see that it is numeric but has no precision set.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: Numeric Precision is not set correctly in postgresql

Post by OutOfTouch6947 » Wed 01 Feb 2017 19:03

OutOfTouch6947 wrote:
Shalex wrote:You are working with LinqConnect Model (*.lqml), aren't you?
OutOfTouch6947 wrote:I don't know what I need to do to set precision and scale in the database from the model
Please double click the required property in Model Explorer (or on diagram) to open Property Editor and set Server Data Type to data type with precision and scale: numeric(28,10) instead of just numeric.
Already tried what you suggested here before I created my ticket, please try to reproduce on your end or double check that this functions correctly. After doing this and updating the database using the model and checking the database I can clearly see that it is numeric but has no precision set.
It looks like it might a case issue for example NUMERIC(28,10) vs numeric(28,10)

Shalex
Site Admin
Posts: 8241
Joined: Thu 14 Aug 2008 12:44

Re: Numeric Precision is not set correctly in postgresql

Post by Shalex » Thu 02 Feb 2017 09:36

OutOfTouch6947 wrote:please try to reproduce on your end or double check that this functions correctly.
Tried and double checked: we cannot reproduce the issue.
OutOfTouch6947 wrote:After doing this and updating the database using the model and checking the database I can clearly see that it is numeric but has no precision set.
Please open the Script tab on the "View and execute script" step of Update To Database Wizard and make sure that DDL for creating/altering column includes precision and scale, e.g.:

Code: Select all

ALTER TABLE public.test_table
   ALTER COLUMN test_column TYPE NUMERIC(28,10);
If this doesn't help to narrow down and fix the problem, please send us a test model and specify the exact steps we should follow to reproduce the issue.

OutOfTouch6947
Posts: 79
Joined: Tue 02 Jun 2015 18:22

Re: Numeric Precision is not set correctly in postgresql

Post by OutOfTouch6947 » Tue 21 Feb 2017 18:40

Shalex wrote:
OutOfTouch6947 wrote:please try to reproduce on your end or double check that this functions correctly.
Tried and double checked: we cannot reproduce the issue.
OutOfTouch6947 wrote:After doing this and updating the database using the model and checking the database I can clearly see that it is numeric but has no precision set.
Please open the Script tab on the "View and execute script" step of Update To Database Wizard and make sure that DDL for creating/altering column includes precision and scale, e.g.:

Code: Select all

ALTER TABLE public.test_table
   ALTER COLUMN test_column TYPE NUMERIC(28,10);
If this doesn't help to narrow down and fix the problem, please send us a test model and specify the exact steps we should follow to reproduce the issue.
I just got time to get back to this and it still is an issue, here is an example from the script tab, I can see it is not sending the correct script.

Code: Select all

CREATE TABLE public."TaxRatesMNVA" (
   "ZipCode" CHAR(6) NOT NULL,
   "TaxName" CHAR(30) NOT NULL,
   "TaxState" CHAR(2) NOT NULL,
   "TaxRate" DECIMAL,
   CONSTRAINT "PK_TaxRatesMNVA" PRIMARY KEY ("ZipCode")
);
Here is what I have on the Server Data Type of the column in the Model Designer: numeric(28,10)

Shalex
Site Admin
Posts: 8241
Joined: Thu 14 Aug 2008 12:44

Re: Numeric Precision is not set correctly in postgresql

Post by Shalex » Mon 27 Feb 2017 15:37

The Server Data Type of the column is reset NUMERIC(28,10) -> DECIMAL if you select the "Recreate Database Tables" option in Update To Database or Generate Database Script wizards.

If this doesn't help, send us a test model and specify the exact steps we should follow to reproduce the issue.

Post Reply