Skip to content

Commit ad46a2a

Browse files
committed
Remove unreachable code in expression evaluation.
The previous code still contained expression evaluation time support for CaseExprs without a defresult. But transformCaseExpr() creates a default expression if necessary. Author: Andres Freund Discussion: https://postgr.es/m/4834.1490480275@sss.pgh.pa.us
1 parent 8acf08c commit ad46a2a

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/backend/executor/execExpr.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,20 +1385,12 @@ ExecInitExprRec(Expr *node, PlanState *parent, ExprState *state,
13851385
state->steps[whenstep].d.jump.jumpdone = state->steps_len;
13861386
}
13871387

1388-
if (caseExpr->defresult)
1389-
{
1390-
/* evaluate ELSE expr into CASE's result variables */
1391-
ExecInitExprRec(caseExpr->defresult, parent, state,
1392-
resv, resnull);
1393-
}
1394-
else
1395-
{
1396-
/* default ELSE is to return NULL */
1397-
scratch.opcode = EEOP_CONST;
1398-
scratch.d.constval.value = (Datum) 0;
1399-
scratch.d.constval.isnull = true;
1400-
ExprEvalPushStep(state, &scratch);
1401-
}
1388+
/* transformCaseExpr always adds a default */
1389+
Assert(caseExpr->defresult);
1390+
1391+
/* evaluate ELSE expr into CASE's result variables */
1392+
ExecInitExprRec(caseExpr->defresult, parent, state,
1393+
resv, resnull);
14021394

14031395
/* adjust jump targets */
14041396
foreach(lc, adjust_jumps)

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