Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiQcd-00083M-V1 for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 20:43:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fiQcZ-0007PR-TH for pgsql-hackers@arkaria.postgresql.org; Wed, 25 Jul 2018 20:42:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiQcZ-0007PK-Iu for pgsql-hackers@lists.postgresql.org; Wed, 25 Jul 2018 20:42:55 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fiQcW-0003Fg-Fv for pgsql-hackers@postgresql.org; Wed, 25 Jul 2018 20:42:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w6PKgfX9027594; Wed, 25 Jul 2018 16:42:41 -0400 From: Tom Lane To: Robert Haas cc: Etsuro Fujita , Andres Freund , Ashutosh Bapat , Rajkumar Raghuwanshi , pgsql-hackers Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. In-reply-to: References: <5AFC0865.8050802@lab.ntt.co.jp> <5AFD6580.5090308@lab.ntt.co.jp> <5AFE81CC.8000508@lab.ntt.co.jp> <5B17C5EC.1090602@lab.ntt.co.jp> <5B1E5071.1000704@lab.ntt.co.jp> <5B23A964.9020800@lab.ntt.co.jp> <5B28FB19.3090809@lab.ntt.co.jp> <20180703163519.tsigyic5xefunv74@alap3.anarazel.de> <5B3C2A4E.5030901@lab.ntt.co.jp> <5B4F2BE9.3000304@lab.ntt.co.jp> <5B55886F.5090906@lab.ntt.co.jp> <5B5712C8.9030404@lab.ntt.co.jp> Comments: In-reply-to Robert Haas message dated "Wed, 25 Jul 2018 16:27:41 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27592.1532551361.1@sss.pgh.pa.us> Date: Wed, 25 Jul 2018 16:42:41 -0400 Message-ID: <27593.1532551361@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Tue, Jul 24, 2018 at 7:51 AM, Etsuro Fujita > wrote: >> I'm not sure that's a good idea, because I think we have a trade-off >> relation; the more we make create_plan simple, the more we need to make >> earlier states of the planner complicated. >> >> And it looks to me like the partitionwise join code is making earlier (and >> later) stages of the planner too complicated, to make create_plan simple. > I think that create_plan is *supposed* to be simple. Its purpose is > to prune away data that's only needed during planning and add things > that can be computed at the last minute which are needed at execution > time. Making it do anything else is, in my opinion, not good. I tend to agree with Robert on this. In particular, if you put anything into create_plan or later that affects cost estimates, you're really doing it wrong, because changing those estimates might've changed the plan entirely. (As I recall, we have a couple of cheats like that now, associated with dropping no-op projection and subquery scan nodes. But let's not add more.) TBH, I think this entire discussion is proving what sheer folly it was to allow partitions to have rowtypes not identical to their parent. But I suppose we're stuck with that now. regards, tom lane