Re: Optimze usage of immutable functions as relation
Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
From: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>, Aleksandr Parfenov <asp437@gmail.com>
Cc: a.bykov@postgrespro.ru, pgsql-hackers@lists.postgresql.org,
Antonin Houska <ah@cybertec.at>,
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Date: 2019-03-20T16:58:21Z
Lists: pgsql-hackers
Attachments
- v5-0001-Simplify-immutable-RTE_FUNCTION-to-RTE_RESULT.patch (text/x-patch)
On 11/16/18 22:03, Tom Lane wrote: > A possible fix for this is to do eval_const_expressions() on > function RTE expressions at this stage (and then not need to > do it later), and then pull up only when we find that the > RTE expression has been reduced to a single Const. Attached is a patch that does this, and transforms RTE_FUCTION that was reduced to a single Const into an RTE_RESULT. Not sure it does everything correctly, but some basic cases work. In particular, I don't understand whether it needs any handling of "append relations". -- Alexander Kuzmenkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company
Commits
-
Prevent bogus pullup of constant-valued functions returning composite.
- a9ae99d01909 13.0 landed
-
Allow functions-in-FROM to be pulled up if they reduce to constants.
- 7266d0997dd2 13.0 landed