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 1fWMWT-0003yA-0t for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jun 2018 13:54:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fWMWQ-0006Oy-Ds for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Jun 2018 13:54:42 +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 1fWMWQ-0006Or-3w for pgsql-hackers@lists.postgresql.org; Fri, 22 Jun 2018 13:54:42 +0000 Received: from mail-pg0-x230.google.com ([2607:f8b0:400e:c05::230]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fWMWN-0006vH-81 for pgsql-hackers@postgresql.org; Fri, 22 Jun 2018 13:54:40 +0000 Received: by mail-pg0-x230.google.com with SMTP id g26-v6so3006871pgn.11 for ; Fri, 22 Jun 2018 06:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Mwe+J6yiixOigSRbHMIGyp/NNP21f/tDiQYUlChewQc=; b=O/iOvk222Ld2pvIrI3TEq/rRBcXB9rby65HVA9KOX9IBG5x0ZT3Pyu6SwOaJL98L8j 97BEd7ZO3/xZROWsWUJje5AdCc98D3kwKLdCa+d9Tc/jiVAM2qBvoscpUD8VGysRlMbd reBiSrI8s6LJXc7Tb03w3QIwNoGQvnChXh7FnyqraT4MLB3ldnL3VHFY1nn9nnDPxhqz dBLYU9fipflMjQbyb0RbgAmMza46vvB1m2gW1HHEvpHABTci6xEhc2jWfzHQwW3nh4uP hPz92ARaFaOLmtsvXZn1zPOK0AS0zQlvSMAmY2x3rTkSJ2T51icZinYSH0jth5L+wCkm rmTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Mwe+J6yiixOigSRbHMIGyp/NNP21f/tDiQYUlChewQc=; b=uVsVkBPdlqeLTcaAFjCY0Z0LqoG9EqbfbXc/OX3aXAZz4A7NTmB0fyT8+ZOeo+91HR 178sVFEF0W/Wgj77WNu4a2KiRO0+qekDS6tlr74m7826V6PzTklgTtoUSQy1YiZXIzbL Mu51+6qqE/K+lcl2VbassytH9NB0BYxGuS5zfL7rt0ZvHDDrwwzU3ZYaMqJr3N7bZ5ea IlifCne4MhWuBQzv/L+4Q0/rLPZJyuE45FJFa+EDIQnIB0QI1PgQOcVT3ggRDZ0B9Jrq u7av91PS715wrHaehF7jsQWuAST+sFgg7OAzQwXqkMTvVPqtL0v9EIgmDMfyGCaLOGr/ KNrQ== X-Gm-Message-State: APt69E09GycRQfrF2+/30stfsPBw56voPxheyo1zE2GJQYQnGf3+M7wD +11ANa4/Mr/GJ8KNw6XM8Fqn+O3KzzRHnly7UhsTVQ== X-Google-Smtp-Source: ADUXVKLJnrE3DiU6eYvea3ORkxTkHc8t6JcNmzfb7JzrhWOvladE/32+sPhPFFdqYZxnhgEXiiR8/5I0UTN4JXQFhA4= X-Received: by 2002:a65:504a:: with SMTP id k10-v6mr1516106pgo.151.1529675678153; Fri, 22 Jun 2018 06:54:38 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:b43:0:0:0:0 with HTTP; Fri, 22 Jun 2018 06:54:37 -0700 (PDT) In-Reply-To: <5B28FB19.3090809@lab.ntt.co.jp> References: <5AE84FBF.3040905@lab.ntt.co.jp> <5AF2E09F.9060208@lab.ntt.co.jp> <5AF440C2.3040805@lab.ntt.co.jp> <5AF59415.10309@lab.ntt.co.jp> <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> From: Ashutosh Bapat Date: Fri, 22 Jun 2018 19:24:37 +0530 Message-ID: Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. To: Etsuro Fujita Cc: Rajkumar Raghuwanshi , pgsql-hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jun 19, 2018 at 6:16 PM, Etsuro Fujita wrote: > > * As I said upthread, the patch makes code much more simple; I removed all > the changes to setrefs.c added by the partitionwise-join patch. I also > simplified the logic for building a tlist for a child-join rel. The original > PWJ computes attr_needed data even for child rels, and build the tlist for a > child-join by passing to build_joinrel_tlist that data for input child rels > for the child-join. But I think that's redundant, and it's more > straightforward to apply adjust_appendrel_attrs to the parent-join's tlist > to get the child-join's tlist. So, I changed that way, which made > unnecessary all the changes to build_joinrel_tlist and placeholder.c added > by the PWJ patch, so I removed those as well. > > * The patch contains all of the regression tests in the original patch > proposed by Ashutosh. I have started reviewing the patch. + if (enable_partitionwise_join && rel->top_parent_is_partitioned) + { + build_childrel_tlist(root, rel, childrel, 1, &appinfo); + } Why do we need rel->top_parent_is_partitioned? If a relation is partitioned (if (rel->part_scheme), it's either the top parent or is partition of some other partitioned table. In either case this condition will be true. + /* No work if the child plan is an Append or MergeAppend */ + if (IsA(subplan, Append) || IsA(subplan, MergeAppend)) + return; Why? Probably it's related to the answer to the first question, But I don't see the connection. Given that partition-wise join will be applicable level by level, we need to recurse in adjust_subplan_tlist(). + /* The child plan should be able to do projection */ + Assert(is_projection_capable_plan(subplan)); + Again why? A MergeAppend's subplan could be a Sort plan, which will not be projection capable. This is not a full review. I will continue reviewing it further. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company