Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHY1x-0005eD-Rg for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Oct 2018 17:42:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gHY1u-0002N2-LW for pgsql-bugs@arkaria.postgresql.org; Tue, 30 Oct 2018 17:42:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHY1s-0002Lm-GY for pgsql-bugs@lists.postgresql.org; Tue, 30 Oct 2018 17:42:14 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gHY1k-0005uw-Hj for pgsql-bugs@lists.postgresql.org; Tue, 30 Oct 2018 17:42:11 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7C20B21F51; Tue, 30 Oct 2018 13:42:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 30 Oct 2018 13:42:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=47uWeLFHRZl825a2kjUbprGlU7T R+hH1cQGXTopvCo8=; b=jBZz1YrG/N1+SNBprNZC4KvYxORkhnqdWbywzGiblSc WLoCiViQ7Bqq30P66B8NWlPXkXBTgtyJ8puYeDg+uwjZ7eHE2MlXg6EMFjnXumc9 TerYt3FZ99XejtbB27hOSJ32klR85qwITtYkuL99RmPobeL6lwyDIMTaedwpkgJQ WF4ThZmj3I8GqnqTi1fok+geiNnJM1qXhT2JtSpQXZ1UtY+4So4W0qzGZ+u+eW7Y tdyz3dCSNp+FpGvaDZKD7pkvEW46bonXii5mDH3AhLJj7KCllyFmgZbcPoKjkbz5 SE2erCcWZZe/MAsNpWcHnISBAFLEp0VRHwY1hBjB2Ig== 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-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=47uWeL FHRZl825a2kjUbprGlU7TR+hH1cQGXTopvCo8=; b=ZnW9nPo7GAYHwnyXRfC0Za WECbIFnquuijG4N4IUzbXwq3Ob/GK6LwYJl2JIiwqvr/JPkLxhxYLwOVaTig1fyx 2xB41UxeeXfLfhbz+D7NR2BYHLLO7XnvULT39Nnjv3ZFKnIDIHPDa5RqKpFGPJV/ JIVlGptvX071+KwfJwtbQI9rzWFeSODhCPNPibxoawUZ1tfJoUPR1c/ozXiRk1bq XH4Jv3LvlQJ/qZnWdGnYJpDQr54GoNgh7J5NGscVakfZnwWx7T5gK8bEbaioBGpI vucNvzZz3rdWMmcAgZsRAnSKoZ5voVKiu/dL7iEW4jN1gb0Zx8gRyRxRU9Q9bEJg == X-ME-Sender: X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id 728B7102EB; Tue, 30 Oct 2018 13:42:02 -0400 (EDT) Date: Tue, 30 Oct 2018 10:42:00 -0700 From: Andres Freund To: Tom Lane Cc: pg@mattyw.net, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15471: psql 11 array concatenation in CASE takes on values from the CASE expression when using enum_range Message-ID: <20181030174200.uht4cysuzcovgerx@alap3.anarazel.de> References: <15471-1117f49271989bad@postgresql.org> <8112.1540900775@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8112.1540900775@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2018-10-30 07:59:35 -0400, Tom Lane wrote: > =?utf-8?q?PG_Bug_reporting_form?= writes: > > Below is an example .sql file that replicates the problem. Put simply, when > > we array concat with enum_range in the result of a CASE statement the > > concatenation takes the expression from the CASE statement, not the enum > > range. > > Wow, that's ... bizarre. I'm thinking that we probably did something > silly in the big expression-execution rewrite, but it's not clear exactly > where. It can't be "the big one", because then it'd be in 10 too, right? > So somehow the planner is messing up and inserting an outer CaseTestExpr > value as the source of the elemexpr's coercion expression. IIRC, > ruleutils doesn't print the elemexpr at all, which is how come we're not > seeing the mistake in the EXPLAIN output. > > However, ArrayCoerceExpr has abused CaseTestExpr that way for awhile, so > it's still not very clear why it broke in v11 and not before ... Without further analysis, the only commit that looks midly relevant is commit c12d570fa147d0ec273df53de3a2802925d551ba Author: Tom Lane Date: 2017-09-30 13:40:56 -0400 Support arrays over domains. Greetings, Andres Freund