Page 1 of 1

Inconsistent types deduced for parameter $2

Posted: Wed 22 Apr 2009 15:49
by yapt
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)

Posted: Wed 22 Apr 2009 16:19
by yapt
If I set UnpreparedExecute to TRUE then I get an error:
'Assertion failure (-path_to_source-\PgClasses.pas, line 5596).'

Posted: Fri 24 Apr 2009 07:17
by Plash
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;

Posted: Fri 24 Apr 2009 08:10
by yapt
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.