inconsistent types deduced for parameter

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
adroege
Posts: 16
Joined: Tue 07 Apr 2009 16:13
Location: Orlando, FL

inconsistent types deduced for parameter

Post by adroege » Tue 19 May 2009 18:03

I am getting the following error when I try to run a query using a TUniSQL with the postgresql provider:

'inconsistent types deduced for parameter $3'

The query is:

INSERT INTO ugmem( groupnum, usernum, grouptype )
SELECT :groupnum, :usernum, :grouptype
WHERE NOT EXISTS( SELECT id FROM ugmem WHERE groupnum = :groupnum AND usernum = :usernum AND grouptype = :grouptype )

If I comment out the WHERE clause, the query runs fine (however it is incorrect).

I noticed a forum post detailing this issue on the TpgQuery and the new UseParamTypes option. Is this option available in the UniDac (TUniSQL) components? If not, how do I get this to work?

Thanks

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

Post by Plash » Wed 20 May 2009 07:10

We have added this option to UniDAC. But the build with the UseParamTypes option is not yet released. We are planning to release the new build in a week.

adroege
Posts: 16
Joined: Tue 07 Apr 2009 16:13
Location: Orlando, FL

Post by adroege » Thu 28 May 2009 18:53

I've downloaded the 2.7 UniDAC (for Delphi 7) and I'm still having an issue. I've added the following to a TUniSQL component:

Code: Select all

SpecificOptions.Add( 'PostgreSQL.UseParamTypes=True' )
Given the following query:

Code: Select all

INSERT INTO emailheaders_13( AccountName, MailboxName, UID, Sender, ToList, CCList, DateSent, Subject, Flags, MsgRead, AttachmentIndex, RequestReceipt, Deleted )
SELECT :AccountName, :MailboxName, :UID, :Sender, :ToList, :CCList, :DateSent, :Subject, :Flags, :MsgRead, :AttachmentIndex, :RequestReceipt, :Deleted
WHERE NOT EXISTS( 
	SELECT UID FROM emailheaders_13 
	WHERE UID = :uid 
	AND AccountName ilike :accountname 
	AND MailboxName ilike :mailboxname 
)
I now get the error:
"operator does not exist: integer = character varying"

when I call prepare.

If I take the AccountName and MailboxName conditions out of the subselect, I don't get the error. If I set the UserParamTypes = False, I'm back to the "Inconsistent Types deduced..." error.

I'm using Delphi 7, PostgreSQL 8.3

Any ideas on how I can get this to work properly?

Thanks

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

Post by Plash » Fri 29 May 2009 06:13

You should set the DataType property of parameters to the correct values. (Set it to ftInteger for the UID parameter.)

Post Reply