]> granicus.if.org Git - postgresql/commit - src/pl/plpgsql/src/pl_comp.c
Add support for invoking parser callback hooks via SPI and in cached plans.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Nov 2009 22:26:08 +0000 (22:26 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 4 Nov 2009 22:26:08 +0000 (22:26 +0000)
commit9bedd128d6ed83798004b3c7ddc33f33703ccf23
tree95a475a5da180f19c69b5bcf2f6e764b1bc69ea7
parent48912acc089a6148529f12ab0a75b1bf026f231d
Add support for invoking parser callback hooks via SPI and in cached plans.

As proof of concept, modify plpgsql to use the hooks.  plpgsql is still
inserting $n symbols textually, but the "back end" of the parsing process now
goes through the ParamRef hook instead of using a fixed parameter-type array,
and then execution only fetches actually-referenced parameters, using a hook
added to ParamListInfo.

Although there's a lot left to be done in plpgsql, this already cures the
"if (TG_OP = 'INSERT' and NEW.foo ...)"  problem, as illustrated by the
changed regression test.
23 files changed:
doc/src/sgml/spi.sgml
src/backend/commands/explain.c
src/backend/commands/prepare.c
src/backend/executor/execCurrent.c
src/backend/executor/execQual.c
src/backend/executor/functions.c
src/backend/executor/spi.c
src/backend/nodes/params.c
src/backend/tcop/postgres.c
src/backend/utils/cache/plancache.c
src/include/executor/spi.h
src/include/executor/spi_priv.h
src/include/nodes/params.h
src/include/tcop/tcopprot.h
src/include/utils/plancache.h
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/pl_handler.c
src/pl/plpgsql/src/plpgsql.h
src/test/regress/expected/plpgsql.out
src/test/regress/sql/plpgsql.sql