Error when setting the PgTable "DefaultValues"=true

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Error when setting the PgTable "DefaultValues"=true

Post by radub » Sun 01 Dec 2013 20:35

Hello,

I have a small project with PgConnection, PgTable, DataseProvider, ClientDataset components.
If in the PgTable I set the option "DefaultValues"=true, when I open the ClientDataset, I receive the error "Filter expression incorrectly terminated".
The table is formed by an ID serial, and 2 varchar field and an unicity index on one of this varchar fields.

Is there any other options to be set to bypass this error?

Thank you,

Radu B.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error when setting the PgTable "DefaultValues"=true

Post by AlexP » Mon 02 Dec 2013 14:42

Hello,

This problem is due to that ClientDataSet cannot parse the expression returned as a default field value for the Serial type ('nextval(''sequence_name''::regclass)). To solve the problem, you can use a regular field instead of the Serial type and create a trigger, in which a value for this field will be generated.

radub
Posts: 105
Joined: Sat 10 Jul 2010 18:46

Re: Error when setting the PgTable "DefaultValues"=true

Post by radub » Wed 04 Dec 2013 06:59

Hello,

I have replaced all 186 fields... and after a day long, indeed it works.

It would have been better if the help on "DefaultValues" has had specified such a situation.

Case closed.

Thank you,
Radu B.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error when setting the PgTable "DefaultValues"=true

Post by AlexP » Mon 09 Dec 2013 10:04

Hello,

Unfortunately, we cannot affect the behaviour, since the value for a serial field is set with a sequence and cannot be set while opening the table. We need to get the query for correct retrieving of the sequence value when inserting a new record. As I wrote you earlier, it is better to use a trigger in such a situation.

Post Reply