diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-30 22:24:16 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-11-30 22:24:16 +0000 |
commit | 6144601f427405d16f102179372cd58481280ab3 (patch) | |
tree | 24dfe4c8581e6829866d0bc73b2a7ba790931694 | |
parent | a0547f6ea2cd86264ae7931c9128ba241b8c9327 (diff) | |
download | postgresql-6144601f427405d16f102179372cd58481280ab3.tar.gz postgresql-6144601f427405d16f102179372cd58481280ab3.zip |
Back-patch fix to check vartypmod when matching PlannerParamVar entries.
This should prevent some obscure cases of 'variable not in subplan target
lists', although actual failures have only been reported against 7.4 in
which the bug is much easier to trigger.
-rw-r--r-- | src/backend/optimizer/plan/subselect.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c index 1dcebba2e77..91f0056b6ac 100644 --- a/src/backend/optimizer/plan/subselect.c +++ b/src/backend/optimizer/plan/subselect.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.55 2002/09/04 20:31:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/subselect.c,v 1.55.2.1 2003/11/30 22:24:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -90,6 +90,11 @@ replace_var(Var *var) * well, I believe that this sort of aliasing will cause no trouble. * The correct field should get stored into the Param slot at * execution in each part of the tree. + * + * We also need to demand a match on vartypmod. This does not matter + * for the Param itself, since those are not typmod-dependent, but it + * does matter when make_subplan() instantiates a modified copy of the + * Var for a subplan's args list. */ i = 0; foreach(ppv, PlannerParamVar) @@ -99,7 +104,8 @@ replace_var(Var *var) if (pvar->varno == var->varno && pvar->varattno == var->varattno && pvar->varlevelsup == varlevel && - pvar->vartype == var->vartype) + pvar->vartype == var->vartype && + pvar->vartypmod == var->vartypmod) break; i++; } |