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
inconsistent types deduced for parameter
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:
Given the following query:
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
Code: Select all
SpecificOptions.Add( 'PostgreSQL.UseParamTypes=True' )
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
)
"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