Add support for Case exprs to fix_indxqual_references,

so that Case works in WHERE join clauses.  Temporary patch --- this routine
is one of many that ought to be changed to use centralized expression-tree-
walking logic.
This commit is contained in:
Tom Lane 1999-07-29 02:48:05 +00:00
parent 6b157f376a
commit ecbfafbe0e
1 changed files with 32 additions and 1 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.64 1999/07/27 03:51:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.65 1999/07/29 02:48:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -740,6 +740,37 @@ fix_indxqual_references(Node *clause, Path *index_path)
return (Node *) newnode;
}
else if (IsA(clause, CaseExpr))
{
CaseExpr *oldnode = (CaseExpr *) clause;
CaseExpr *newnode = makeNode(CaseExpr);
newnode->casetype = oldnode->casetype;
newnode->arg = oldnode->arg; /* XXX should always be null
* anyway ... */
newnode->args = (List *)
fix_indxqual_references((Node *) oldnode->args,
index_path);
newnode->defresult =
fix_indxqual_references(oldnode->defresult,
index_path);
return (Node *) newnode;
}
else if (IsA(clause, CaseWhen))
{
CaseWhen *oldnode = (CaseWhen *) clause;
CaseWhen *newnode = makeNode(CaseWhen);
newnode->expr =
fix_indxqual_references(oldnode->expr,
index_path);
newnode->result =
fix_indxqual_references(oldnode->result,
index_path);
return (Node *) newnode;
}
else
{
elog(ERROR, "fix_indxqual_references: Cannot handle node type %d",