On 01/06/2012 16:36, Knut Anders Hatlen wrote:
Does the insert statement work if you rewrite it to
  INSERT INTO resource_usage (resid,itemid,itemtype)
    (SELECT resid, CAST(? AS INT), CAST(? AS VARCHAR(32672))
     FROM resource_usage
     WHERE itemid=?
     AND   itemtype=?
     AND   NOT EXISTS (SELECT resid FROM resource_usage
                       WHERE itemid=? AND itemtype=?));
?
Alas, no. Same error.
Of course, it's a bug that the compiler doesn't catch this and report a
syntax error. It would be worth filing a bug report to get this
improved.
As soon as I fix this I will look into this further!
--
John English If we were to define a religion to be a system of thought which contains unprovable statements, so it contains an element of faith, then Gödel has taught us that not only is mathematics a religion but it is the only religion able to prove itself to be one.
John Barrow, Pi in the Sky