-
I'm trying to translate the following SQL into squeal with
vals as (values (4, 5, 1.2))
insert into recipes (proc_id, prod_id, amount)
select *
from vals
on conflict (proc_id, prod_id) do
update set amount = excluded.amount
returning id I thought this would be the equivalent using squeal with
(values_ (4 `as` #proc_id :* 5 `as` #ingr_id :* 1.2 `as` #amount) `as` #vals)
(insertInto #recipes
(Select (Default `as` #id :*
Set (#vals ! #proc_id) `as` #proc_id :*
Set (#vals ! #ingr_id) `as` #prod_id :*
Set (#vals ! #amount) `as` #amount)
(from (common #vals)))
(OnConflict (OnConstraint #uq_recs_ids)
(DoUpdate (Set (#excluded ! #amount) `as` #amount) []))
(Returning_ #id)) but I seem to get stuck on the two parts not being of the same type, How do I combine a query and a manipulation in a |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Nevermind, I managed to find |
Beta Was this translation helpful? Give feedback.
-
However, |
Beta Was this translation helpful? Give feedback.
Nevermind, I managed to find
queryStatement
and turned my query into a manipulation that way.