Thread: pgsql: Preliminary refactoring of plpgsql expression construction.

pgsql: Preliminary refactoring of plpgsql expression construction.

From
Tom Lane
Date:
Preliminary refactoring of plpgsql expression construction.

This short and boring patch simply moves the responsibility for
initializing PLpgSQL_expr.target_param into plpgsql parsing,
rather than doing it at first execution of the expr as before.
This doesn't save anything in terms of runtime, since the work was
trivial and done only once per expr anyway.  But it makes the info
available during parsing, which will be useful for the next step.

Likewise set PLpgSQL_expr.func during parsing.  According to the
comments, this was once impossible; but it's certainly possible
since we invented the plpgsql_curr_compile variable.  Again, this
saves little runtime, but it seems far cleaner conceptually.

While at it, I reordered stuff in struct PLpgSQL_expr to make it
clearer which fields are filled when, and merged some duplicative
code in pl_gram.y.

Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Discussion: https://postgr.es/m/CACxu=vJaKFNsYxooSnW1wEgsAO5u_v1XYBacfVJ14wgJV_PYeg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a654af21ae522cc8e867e052defd16f76ffaef2e

Modified Files
--------------
src/pl/plpgsql/src/pl_exec.c | 27 ------------------
src/pl/plpgsql/src/pl_gram.y | 65 ++++++++++++++++++++++++++++++--------------
src/pl/plpgsql/src/plpgsql.h | 31 ++++++++++++---------
3 files changed, 62 insertions(+), 61 deletions(-)