Inconsistent types deduced for parameter $2

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Inconsistent types deduced for parameter $2

Post by yapt » Wed 22 Apr 2009 15:49

Hello,

I have a TPgSQL like this:

Code: Select all

INSERT INTO mwi.artprov
  SELECT :PEM, :PCO, :PPR, :PCA
    WHERE NOT EXISTS
      (SELECT TRUE 
          FROM mwi.artprov
          WHERE
                 em   = :PEM
             AND co = :PCO
             AND pr = :PPR
             AND ca = :PCD);
But when I try to exec it then I receive an 'Inconsistent types deduced for parameter $2'.

I have set parameters types manually too, but same error.

Any idea ?


Table definition:

Code: Select all

CREATE TABLE mwi.artprov (
	em numeric(1) NOT NULL,
	co mwi.co NOT NULL,
	pr numeric(5) NOT NULL,
	ca mwi.ca NOT NULL,
where domains mwi.co and mwi.ca are specified on this way:
mwi.co varchar(12)
mwi.ca numeric(13)

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Wed 22 Apr 2009 16:19

If I set UnpreparedExecute to TRUE then I get an error:
'Assertion failure (-path_to_source-\PgClasses.pas, line 5596).'

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Fri 24 Apr 2009 07:17

We have fixed the problem with inconsistent types. We have added the UseParamTypes option to TPgQuery. You should set this option to True, and set the DataType property for all parameters.

You should set this option to True also to avoid the problem with editing fields based on the domain types (You have described this problem in the previous topic).

I have sent the PgDAC installation with the fix to your e-mail.

Probably you get error with UnpreparedExecute because you have set ParamCheck to False. You don't need to add parameters to set its DataType. Use ParamCheck=True and the ParamByName method to set DataType of existing parameters:

PgQuery.ParamByName('PEM').DataType := ftFloat;

yapt
Posts: 69
Joined: Mon 16 Mar 2009 12:06

Post by yapt » Fri 24 Apr 2009 08:10

Yes, when I have received: "Assertion failure" error, I had also set ParamCheck to FALSE to try avoid the problem.

I will test it ASAP and report results.

Post Reply