MySql: updateWhere does not update UTCTime field correctly #161

andrebask opened this Issue Sep 20, 2013 · 2 comments


None yet

3 participants


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 
"",PersistText "andrebask"]
 @(persistent- ./Database/Persist/Sql/Raw.hs:37:5)

The problem is that, after running this command, the database record appears like this:

id| title   | url        |site             | read                | user
1 | Il Post | http://... | | 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?

BJTerry commented Sep 20, 2013

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.

@gregwebs gregwebs added the MySQL label Aug 4, 2014
@gregwebs gregwebs closed this Sep 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment