#PostgreSQL / #SQL question:

SELECT my_func(x.some_col)
FROM x
ORDER BY x.some_col

AFAIK this doesn't guarantee the order in which `my_func` is called. How can I force the order without relying on undefined behavior? Is it possible without plpgsql?
my_func() in this case has DML side-effects, that's why I care about the order.
The reason I ask is that the PostgreSQL docs indicate that the `ORDER BY` is usually evaluated *after* the select output expression.

My experiment's show that this often isn't the case, but I hate to rely on undocumented implementation details for the correctness of my code.
You can follow @felixge.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: