On Monday, June 3, 2019 1:03:44 P.M. EDT Tom Lane wrote: > CASE is a scalar-expression construct. It's got little to do with > the timing of scan/join operations such as row fetches. We offer > users essentially no control over when those happen ... other than > the guarantees about CTE materialization, which are exactly what > you say you want to give up.
In the general case, yes, but I *can* use a scalar-returning INSERT CTE in a THEN clause as a subquery. Useful for a conditional INSERT, when you can't use ON CONFLICT. Anyway, I understand that the complications are probably not worth it. Thanks, Elvis