Skip to content

Commit ecbfafb

Browse files
committed
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.
1 parent 6b157f3 commit ecbfafb

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

src/backend/optimizer/plan/createplan.c

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.64 1999/07/27 03:51:03 tgl Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.65 1999/07/29 02:48:05 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -740,6 +740,37 @@ fix_indxqual_references(Node *clause, Path *index_path)
740740

741741
return (Node *) newnode;
742742
}
743+
else if (IsA(clause, CaseExpr))
744+
{
745+
CaseExpr *oldnode = (CaseExpr *) clause;
746+
CaseExpr *newnode = makeNode(CaseExpr);
747+
748+
newnode->casetype = oldnode->casetype;
749+
newnode->arg = oldnode->arg; /* XXX should always be null
750+
* anyway ... */
751+
newnode->args = (List *)
752+
fix_indxqual_references((Node *) oldnode->args,
753+
index_path);
754+
newnode->defresult =
755+
fix_indxqual_references(oldnode->defresult,
756+
index_path);
757+
758+
return (Node *) newnode;
759+
}
760+
else if (IsA(clause, CaseWhen))
761+
{
762+
CaseWhen *oldnode = (CaseWhen *) clause;
763+
CaseWhen *newnode = makeNode(CaseWhen);
764+
765+
newnode->expr =
766+
fix_indxqual_references(oldnode->expr,
767+
index_path);
768+
newnode->result =
769+
fix_indxqual_references(oldnode->result,
770+
index_path);
771+
772+
return (Node *) newnode;
773+
}
743774
else
744775
{
745776
elog(ERROR, "fix_indxqual_references: Cannot handle node type %d",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy