diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-17 20:48:43 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-03-17 20:48:43 +0000 |
| commit | 55f7c3300d164d370d28b127210223d078da524d (patch) | |
| tree | e5c91b7d50eef3b40dd395e3ecce877bb6663636 /src/include/nodes/execnodes.h | |
| parent | 8c702ea7ace30026dfff4f2e514027cd4d6d7579 (diff) | |
| download | postgresql-55f7c3300d164d370d28b127210223d078da524d.tar.gz | |
Reimplement CASE val WHEN compval1 THEN ... WHEN compval2 THEN ... END
so that the 'val' is computed only once, per recent discussion. The
speedup is not much when 'val' is just a simple variable, but could be
significant for larger expressions. More importantly this avoids issues
with multiple evaluations of a volatile 'val', and it allows the CASE
expression to be reverse-listed in its original form by ruleutils.c.
Diffstat (limited to 'src/include/nodes/execnodes.h')
| -rw-r--r-- | src/include/nodes/execnodes.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index afdd0669d4..440fcc4d57 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.113 2004/03/17 01:02:24 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.114 2004/03/17 20:48:42 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -113,6 +113,10 @@ typedef struct ExprContext Datum *ecxt_aggvalues; /* precomputed values for Aggref nodes */ bool *ecxt_aggnulls; /* null flags for Aggref nodes */ + /* Value to substitute for CaseTestExpr nodes in expression */ + Datum caseValue_datum; + bool caseValue_isNull; + /* Value to substitute for CoerceToDomainValue nodes in expression */ Datum domainValue_datum; bool domainValue_isNull; @@ -566,6 +570,7 @@ typedef struct SubPlanState typedef struct CaseExprState { ExprState xprstate; + ExprState *arg; /* implicit equality comparison argument */ List *args; /* the arguments (list of WHEN clauses) */ ExprState *defresult; /* the default result (ELSE clause) */ } CaseExprState; |
