I can't make this code work:
runDB $ updateWhere [FeedUrl ==. url, FeedUser ==. user] [FeedRead *=. date]
where date is an UTCTime value. This is the debug output:
[Debug#SQL] "UPDATE `feed` SET `read`=`read`*? WHERE (`url`=?) AND
(`user`=?)" [PersistUTCTime 2013-09-20 09:34:48.795 UTC,PersistText
The problem is that, after running this command, the database record appears like this:
id| title | url |site | read | user
1 | Il Post | http://... | feeds.ilpost.it | 0000-00-00 00:00:00 | andrebask|
That "read" field should be 2013-09-20 09:34:48, not 0000-00-00 00:00:00.
All the others persistent functions works well, for example when i use the insert function with UTCTime values, they are correctly inserted.
Could this be a bug in Persistent? Or Did I make something wrong?
The *=. operator updates the existing field by multiplying the value you pass in, so you are multiplying a date by a date. Is that what you intended (the assignment operator is =.)? Also, what database are you using? This should signal an error in PostgreSQL as far as I can tell.
Thank you, the problem was the wrong operator, now it works well.