I want to update a table t
having column c1
and c2
by a Haskell function of type fx :: c1 -> c2
now I want to apply this function to my table t
and update the values of c2
. How I can do this in one run? Like in postgres I will write it as:
update t set c2 = fx(c1);
What will be the esqueleto equivalent for the same ?
Asked
Active
Viewed 183 times
1

Deepak Kapiswe
- 48
- 8
-
1I have very little experience with esqueleto, but I don't think you can do this in "one run" as you want. For that, the Haskell function should have to be computed by the SQL server, and I would be very surprised if you could "export" arbitrary functions to SQL. This could be possible for specific `fx`, though. (Maybe esqueleto allows one to write some functions using special restricted syntax that in the end can be translated into SQL code? I have no idea.) – chi Jul 15 '22 at 10:19