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 1fgUfp-00046R-6I for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 12:38:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgUfn-0000Xj-7l for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 12:38:15 +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.89) (envelope-from ) id 1fgUfm-0000Xc-V2 for pgsql-hackers@lists.postgresql.org; Fri, 20 Jul 2018 12:38:15 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fgUfj-0004ms-Mv for pgsql-hackers@postgresql.org; Fri, 20 Jul 2018 12:38:14 +0000 Received: by mail-lj1-x244.google.com with SMTP id f1-v6so9371001ljc.9 for ; Fri, 20 Jul 2018 05:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=g11Hf1LbvWSv3Mhx+WEiI/nyJnZ3lLDt63KkiIzVfgw=; b=OlFTEppD19hUIzIHFrrBQKivmsL6t1WL0N6yqgN5CWVzWeZv3CqL4bHzoUW0nTq97J 4GHAkhCwYld/HfJo1x2AsxghnWBHojmpPHL7t8qsnS3yOjJOxPn29CRvSWpUqPzb9r7k vnlimChc5hM3/lVtEpn90CREP+LVAZ9s0MNbwgniyClipHHo42K/dtdaAYZEoxAy/sjU l5aVQhHuFPlTBteRFkHJDf0+GhkFaB98JK8LltqlE/VWWKx9j2q0Vj3qXcK6nIEfi+bB RMAlR5VRAvog0cDIVR5crdpCj1mi9XsUizQc23tNnpjgirPNnz72rng+y1zebfgbfosl lXBw== 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=g11Hf1LbvWSv3Mhx+WEiI/nyJnZ3lLDt63KkiIzVfgw=; b=qfO+jY108T1gOYzUUZKwa2eQW6l+XkV32/kYcaxEi2TfgaUCAINTMtUCOc7ZQnatiq rhy4PkZXrmCwZzk6aObkNwK/ekP5O1yDanmyfvsVzhepGilBLZ0qnDyyCu7sxfSWBOhd DkRcbzKQDlbojb47A0EzBq0vkWJhew3BUr3/3L8ICyv8qUqjCULC3OdPdzSqPAPNzjU1 Q4dLTfBwfvvfhjW/mZIPVKZHY/LC7ux6x2byMNVKarI3oYlZZPPvwVMByd8RWkHcX1O+ zh4NLPcPWmOH5k6gKgp4QKIZiH0vCPmdrzSMVcNQEPnL/bhKvvI9VhpzCQbl54kEQclA D76w== X-Gm-Message-State: AOUpUlGn/sQ1VXxlZydEjgxBma85ctdeKbtv0YPz+f8R3/LzdL1NLuIb JuGYydr9B13+d023g6tlS+1k5LCTY9JoAuqpKs4= X-Google-Smtp-Source: AAOMgpcHbhad5lkapLVzpgZ8UboEYCGj6dEW1pITe8QNjz4+Jk26i1vMcDBm7OBf/ttyb8Zv/cs/Ej/wQMS0zPMNw8A= X-Received: by 2002:a2e:9645:: with SMTP id z5-v6mr1514492ljh.127.1532090290821; Fri, 20 Jul 2018 05:38:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a19:e508:0:0:0:0:0 with HTTP; Fri, 20 Jul 2018 05:38:09 -0700 (PDT) In-Reply-To: <5B4F2BE9.3000304@lab.ntt.co.jp> 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> From: Robert Haas Date: Fri, 20 Jul 2018 08:38:09 -0400 Message-ID: Subject: Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled. To: Etsuro Fujita Cc: Andres Freund , Ashutosh Bapat , 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 Wed, Jul 18, 2018 at 8:00 AM, Etsuro Fujita wrote: > [ new patch ] + /* + * If the child plan is an Append or MergeAppend, the targetlists of its + * subplans would have already been adjusted before we get here, so need + * to work here. + */ + if (IsA(subplan, Append) || IsA(subplan, MergeAppend)) + return; + + /* The child plan should be a scan or join */ + Assert(is_projection_capable_plan(subplan)); This looks like a terrible design to me. If somebody in future invents a new plan type that is not projection-capable, then this could fail an assertion here and there won't be any simple fix. And if you reach here and the child targetlists somehow haven't been adjusted, then you won't even fail an assertion, you'll just crash (or maybe return wrong answers). I'm going to study this some more now, but I really think this is going in the wrong direction. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company