update multiple rows with uuid id's

I found a great post by @Andrew Sherman from 2023 describing how to construct a case/when for updating multiple rows in one update. My id's are uuid, and a simple translation of his example (which uses integer ids), fails with the dreaded "operator does not exist: uuid = character varying" error. i've tried adding cast ( as uuid) in several places and can't seem to find it. Here's the toSQL() of a simple single entry update... can anyone spot what i'm missing? Thanks! query { sql: 'update "shows" set "gross" = (case when "shows"."id" = :1 then :2 end) where "shows"."id" in (:3)', params: [ '397ac0a7-d8e3-4a2e-8dcf-789ee99638a5', 1, '397ac0a7-d8e3-4a2e-8dcf-789ee99638a5' ] }
1 Reply
patrick
patrickOP4mo ago
when I execute this directly against Postgres it succeeds, which is weird...
update shows
set gross = (case when id = '397ac0a7-d8e3-4a2e-8dcf-789ee99638a5' then 1 end)
where id in ('397ac0a7-d8e3-4a2e-8dcf-789ee99638a5')
update shows
set gross = (case when id = '397ac0a7-d8e3-4a2e-8dcf-789ee99638a5' then 1 end)
where id in ('397ac0a7-d8e3-4a2e-8dcf-789ee99638a5')
without any cast(xxx as uuid)....
Want results from more Discord servers?
Add your server