diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-15 22:36:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-15 22:36:35 +0000 |
commit | 08f8d478ebc37e42f3ced07d17dae83d6a9a3810 (patch) | |
tree | aedef12bd96c3a789c72ae38e3cfab39801d4556 /src/backend/nodes/params.c | |
parent | 00b5ccebdd0d2925a2e5db0fdf067ea4b7bae799 (diff) | |
download | postgresql-08f8d478ebc37e42f3ced07d17dae83d6a9a3810.tar.gz |
Do parse analysis of an EXPLAIN's contained statement during the normal
parse analysis phase, rather than at execution time. This makes parameter
handling work the same as it does in ordinary plannable queries, and in
particular fixes the incompatibility that Pavel pointed out with plpgsql's
new handling of variable references. plancache.c gets a little bit
grottier, but the alternatives seem worse.
Diffstat (limited to 'src/backend/nodes/params.c')
-rw-r--r-- | src/backend/nodes/params.c | 46 |
1 files changed, 1 insertions, 45 deletions
diff --git a/src/backend/nodes/params.c b/src/backend/nodes/params.c index 136f40ea54..ef17a9bb32 100644 --- a/src/backend/nodes/params.c +++ b/src/backend/nodes/params.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/params.c,v 1.13 2010/01/02 16:57:46 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/params.c,v 1.14 2010/01/15 22:36:31 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -75,47 +75,3 @@ copyParamList(ParamListInfo from) return retval; } - -/* - * Set up the parser to treat the given list of run-time parameters - * as available external parameters during parsing of a new query. - * - * Note that the parser doesn't actually care about the *values* of the given - * parameters, only about their *types*. Also, the code that originally - * provided the ParamListInfo may have provided a setupHook, which should - * override applying parse_fixed_parameters(). - */ -void -setupParserWithParamList(struct ParseState *pstate, - ParamListInfo params) -{ - if (params == NULL) /* no params, nothing to do */ - return; - - /* If there is a parserSetup hook, it gets to do this */ - if (params->parserSetup != NULL) - { - (*params->parserSetup) (pstate, params->parserSetupArg); - return; - } - - /* Else, treat any available parameters as being of fixed type */ - if (params->numParams > 0) - { - Oid *ptypes; - int i; - - ptypes = (Oid *) palloc(params->numParams * sizeof(Oid)); - for (i = 0; i < params->numParams; i++) - { - ParamExternData *prm = ¶ms->params[i]; - - /* give hook a chance in case parameter is dynamic */ - if (!OidIsValid(prm->ptype) && params->paramFetch != NULL) - (*params->paramFetch) (params, i+1); - - ptypes[i] = prm->ptype; - } - parse_fixed_parameters(pstate, ptypes, params->numParams); - } -} |