On Aug 7, 2018, at 9:10 , Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> I've had a to-do item to rewrite and improve the SQL function cache
> mechanism for a long time, but I hadn't thought it was high priority.
> Maybe it should be.
Personally, I would love this. Far too few developers dig into doing things in the database. Conceptually, doing all the data things in the database should be faster, more versatile, more secure etc.
Modern SQL has tools that can make its awfulness tolerable. CTEs and SQL functions spring immediately to mind. But both suffer from optimization fences and corner cases like this that arguably make it not worth the effort.