pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove unreachable code in expression evaluation.
3+ messages / 2 participants
[nested] [flat]

* pgsql: Remove unreachable code in expression evaluation.
@ 2017-03-25 23:03  Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Andres Freund @ 2017-03-25 23:03 UTC (permalink / raw)
  To: pgsql-committers

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

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/ad46a2aa79f9ee79aecd889d0ace9ecc08dae984

Modified Files
--------------
src/backend/executor/execExpr.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Remove unreachable code in expression evaluation.
@ 2017-03-26 04:14  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2017-03-26 04:14 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers

Andres Freund <andres@anarazel.de> writes:
> 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.

BTW, now that I think about it, I wonder if a better answer wouldn't
be to leave the execExpr code as it stood, and remove the code in
transformCaseExpr that pre-creates a default expression.  You'd end
up with identical code at runtime, and eliminate some parse/rewrite/plan
overhead for dealing with that subexpression.

It's possible there's some code somewhere else that expects defresult
to always be non-null, but I can't think what, or why that would be
a good thing to assume.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Remove unreachable code in expression evaluation.
@ 2017-03-26 04:25  Andres Freund <andres@anarazel.de>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Andres Freund @ 2017-03-26 04:25 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers

On 2017-03-26 00:14:30 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > 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.
> 
> BTW, now that I think about it, I wonder if a better answer wouldn't
> be to leave the execExpr code as it stood, and remove the code in
> transformCaseExpr that pre-creates a default expression.  You'd end
> up with identical code at runtime, and eliminate some parse/rewrite/plan
> overhead for dealing with that subexpression.
> 
> It's possible there's some code somewhere else that expects defresult
> to always be non-null, but I can't think what, or why that would be
> a good thing to assume.

There's some relationship with the type inferrence code in
transformCaseExpr().  I don't think it'd be hard to change, however -
just move resultexprs = lcons(newc->defresult, resultexprs); into the
else branch of if defresult == NULL.

- Andres


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-03-26 04:25 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25 23:03 pgsql: Remove unreachable code in expression evaluation. Andres Freund <andres@anarazel.de>
2017-03-26 04:14 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-03-26 04:25   ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox