Problems with datattypes/apply updates with Postgress

With Postgres 9.1, I define a table:

CREATE TYPE product_type AS ENUM (‘normal’, ‘service’, ‘ingredient’, ‘consumable’);

CREATE TABLE Product (

BasePrice MONEY,
PriceUnit1 MONEY NOT NULL,
PriceUnit2 MONEY,
Discount MONEY,
MaxDiscount MONEY,
ProductType product_type,

)

However, the schema say BasePrice/PriceUnit* are Float (with devart) or decimal (with npgsql.net). In the moment of applyupdates:


Debugger Exception Notification

Project CatalogSync.exe raised exception class EDAUpdatesFailedException with message 'One or more updates failed to apply on the server.

1: ERROR: column “baseprice” is of type money but expression is of type double precision at character 593

I need to manually change in the schema to datCurrency. Then with producttype

Project CatalogSync.exe raised exception class EDAUpdatesFailedException with message 'One or more updates failed to apply on the server.

1: ERROR: column “producttype” is of type product_type but expression is of type text at character 972

(Please assign a TDAReconcileProvider to the data adapter for better exception reporting and reconciliation UI)’.

However as I show before, produc_type is a string enum.

The thing that I don’t understand is why RO detect the right datatype only in the applyupdates and not when generate the fields in the schema modeler.

Then in a simpler table:

– Configuraciones globales de la APP.
CREATE TABLE Config (
Id SERIAL PRIMARY KEY,
Name TEXT NOT NULL,
Value TEXT
);

Get this error:


Project CatalogSync.exe raised exception class EDatabaseError with message ‘Field ‘id’ must have a value’.

All my Id are marked as datInteger, not datAutoInc.

P.D> Last RO version, with server .net, client delphi xe2, using Bin2Stream.

P.D.2: When switch to JSOn streamer:

Project CatalogSync.exe raised exception class EROUnregisteredServerException with message ‘An exception was raised on the server: Input string was not in a correct format.’.

Not very usefull…

Hello,

I have reproduced your testcase with DA Winter 2011.

mamcx said: However, the schema say BasePrice/PriceUnit* are Float (with devart) or decimal (with npgsql.net).

SM does type cast with money data type right - it creates appropriate fields as datCurrency

mamcx said: Then with producttype

Project CatalogSync.exe raised exception class EDAUpdatesFailedException with message 'One or more updates failed to apply on the server.

SM doesn’t recognize user-defined type product_type. Thanks for the report, the issue was logged as #53679. While it isn’t fixed you should manually set data type of ProductType field as datMemo (as PgDAC does it)

mamcx said: CREATE TABLE Config (
Id SERIAL PRIMARY KEY,
Name TEXT NOT NULL,
Value TEXT
);


Get this error:

---------------------------
Project CatalogSync.exe raised exception class EDatabaseError with message 'Field 'id' must have a value'.
---------------------------

Postgres automatically set NotNull to True for Primary Key, cause Primary key should have value in any case. And it automatically creates sequence for Serial column, so it becomes AutoInc. SM also recognizes Serial field as datAutoInc.

mamcx said: When switch to JSOn streamer:
---------------------------
Project CatalogSync.exe raised exception class EROUnregisteredServerException with message 'An exception was raised on the server: Input string was not in a correct format.'

When you get this error? I couldn’t reproduce it.

Best regards.

I generate the schema using https://gist.github.com/1503278. However adding manually in the schema modeler have the same issues: The datatypes are wrong, and the serial is not detected as autoinc.

I have 6.0.55.957.

I found that exist a conflict in the definition of the driver:

<DEVART_POSTGRESQL.NET>








</DEVART_POSTGRESQL.NET>

Is necesary to change to NameSymbol="" for applyupdate to work, but If I remove the “:” I get this error:

System.ArgumentException was unhandled
Message=String cannot be of zero length.
Parameter name: oldValue
Source=mscorlib
ParamName=oldValue
StackTrace:
at System.String.ReplaceInternal(String oldValue, String newValue)
at RemObjects.DataAbstract.Server.BaseConnection.GetStoredProcedureParams(String aStoredProcedureName, SchemaParameterCollection& Parameters)
at RemObjects.DataAbstract.Server.BaseConnection.GetCommandParams(String aCommandText, SchemaParameterCollection& Parameters, Boolean TextIsStoredProcedureName)
at BuildService.Program.GenerateSchema(String connectionString) in C:\Proyectos\BestSeller\Cloud\BuildService\Main.cs:line 191
at BuildService.Program.Main(String[] args) in C:\Proyectos\BestSeller\Cloud\BuildService\Main.cs:line 56
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:

Hello.

Sorry for the belated response.
Can point directly in what place this problem exists? Also, can you send information about RemObjects DataAbstract version you are using?

Thanks in advance.

The version is 6.0.55.957. The Devart version is 5.70.293.0.

Reproducing this is easy.

To request the params of a store procedure is necesary to have NameSymbol=":".

Without this happend:


***** - DA Schema Modeler

La longitud de la cadena no puede ser cero.
Nombre del parámetro: oldValue.

(ie: The length of the string can’t be zero. Name of parameter : oldValue).

But to make work the parameterized tables, functions and apply updates is necesary to change it to NameSymbol="" or:

RemObjects.DataAbstract.DAException was unhandled by user code
Message=Cannot find parameter ":category"
Source=RemObjects.DataAbstract.Server
FromServer=false

The parameter category is already created. With the change in the config this work.

The connection string is like this:

DEVART_POSTGRESQL.NET?Server=***.local;Database=BestSeller;UserID=postgres;Password=***;Unicode=true;Initial Schema=sample

Hello.

Thank you for the instructions. Unfortunately, I still can’t reproduce the problem. All works well without any exceptions. Can you send us small testcase with the problem to investigate it in details?

Thanks in advance.