mirror of
https://github.com/postgres/postgres.git
synced 2025-08-25 20:23:07 +03:00
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.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.32 2009/01/01 17:23:59 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/executor/spi_priv.h,v 1.33 2009/11/04 22:26:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -68,6 +68,8 @@ typedef struct _SPI_plan
|
||||
int cursor_options; /* Cursor options used for planning */
|
||||
int nargs; /* number of plan arguments */
|
||||
Oid *argtypes; /* Argument types (NULL if nargs is 0) */
|
||||
ParserSetupHook parserSetup; /* alternative parameter spec method */
|
||||
void *parserSetupArg;
|
||||
} _SPI_plan;
|
||||
|
||||
#endif /* SPI_PRIV_H */
|
||||
|
Reference in New Issue
Block a user