Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crzkJ-0006OJ-UT for pgsql-committers@arkaria.postgresql.org; Sun, 26 Mar 2017 04:25:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1crzkJ-00044l-5W for pgsql-committers@arkaria.postgresql.org; Sun, 26 Mar 2017 04:25:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crzkH-00044W-LP for pgsql-committers@postgresql.org; Sun, 26 Mar 2017 04:25:37 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crzkA-0006LJ-Jf for pgsql-committers@postgresql.org; Sun, 26 Mar 2017 04:25:37 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 3497820AC1; Sun, 26 Mar 2017 00:25:29 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Sun, 26 Mar 2017 00:25:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=39d69Jmr7J8huHFTVF sglDVR3MPz8WkkLlvogTmT/xE=; b=HkOOaysRwDykbe3mb69msbHXlFbmWnzatN qqRshNIgYVBKHg/JcUH3btgUAB4i7ufOSmL+o62pj1dMnB+zaO/R2zHKzfiNgJ8d KU+jIEgCOuV52E05MZ2MFWi5TrV0qu2Utttd/TyHa8J28kBhWGWSi2Eg5kN+/vdv eTSkiSJACgiZgrEL2jbyNCq5qlWcgFFLJou/f9akODOcAS7UqwgeXYSipv9UGVsH b7h9KhO/XZx02RGxXF92ni2+iTC852QbQz5KaGl9UUh+Ij3j2aOBYnZtIhiAgPnT mq0LSpUS+lbWiw6nnZHAwd9vp/MD+uMVo6tgwi8GmCmoEEHIn9bg== X-ME-Sender: X-Sasl-enc: Bz8fcAj2TTfFYX59jxSORVPug6sAB2OBWAQbhJ3lZ9xF 1490502328 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id E0CD8242B6; Sun, 26 Mar 2017 00:25:28 -0400 (EDT) Date: Sat, 25 Mar 2017 21:25:27 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-committers@postgresql.org Subject: Re: pgsql: Remove unreachable code in expression evaluation. Message-ID: <20170326042527.mdxsoht5a4actlzz@alap3.anarazel.de> References: <24361.1490501670@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24361.1490501670@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On 2017-03-26 00:14:30 -0400, Tom Lane wrote: > Andres Freund 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