Persist updateWhere cast error

8 views
Skip to first unread message

kees Bleijenberg

unread,
Jan 18, 2022, 8:30:52 AMJan 18
to Yesod Web Framework
This is my persistmodel for postgresql:

Settingsdb
   naam Text
   contents Text
   deriving Eq Show
   
This is what I do: runDB $ updateWhere  [SettingsdbNaam ==. "xxx"] [SettingsdbContents *=. "yyy"]
and I get:    
SqlError {sqlState = "42883", sqlExecStatus = FatalError, sqlErrorMsg = "operator does not exist: character varying
 * unknown", sqlErrorDetail = "", sqlErrorHint = "No operator matches the given name and argument type(s). You might need to add explicit type casts."}

This is the generated SQL:
[Debug#SQL] UPDATE "settingsdb" SET "contents"="contents"*? WHERE ("naam"=?); [PersistText "yyy",PersistText "xxx"]

What's wrong?

Kees

Michael Snoyman

unread,
Jan 18, 2022, 10:08:51 AMJan 18
to yeso...@googlegroups.com
It looks like you're trying to multiple a string by a string, which seems to be the error message you're observing. What is it you're trying to accomplish?
--
You received this message because you are subscribed to the Google Groups "Yesod Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yesodweb+u...@googlegroups.com.

kees Bleijenberg

unread,
Jan 18, 2022, 10:31:04 AMJan 18
to Yesod Web Framework
Ah, I see.   SettingsdbContents *=. "yyy"  does not mean 'store "yyy" in the field SettingsdbContents. 
In your book you write:
updateWhere [PersonFirstName ==. "Michael"] [PersonAge *=. 2]
as a simple example for updating a record. But is was too complicated for me :-). I thought this code sets the PersonAge to 2, but it is not.
Problem solved. Thanks.

jsch...@gmail.com

unread,
Jan 18, 2022, 4:07:53 PMJan 18
to Yesod Web Framework
Haha, nice one! No C and pointer dereferencing anymore ;-)
Reply all
Reply to author
Forward
0 new messages