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 1fcqLe-0002ln-IY for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 10:58:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fcqLc-0005KA-R7 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Jul 2018 10:58:20 +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 1fcqLc-0005K3-K0 for pgsql-hackers@lists.postgresql.org; Tue, 10 Jul 2018 10:58:20 +0000 Received: from mail-pl0-x231.google.com ([2607:f8b0:400e:c01::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fcqLZ-00007W-Ns for pgsql-hackers@postgresql.org; Tue, 10 Jul 2018 10:58:20 +0000 Received: by mail-pl0-x231.google.com with SMTP id z9-v6so7448312plo.1 for ; Tue, 10 Jul 2018 03:58:17 -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=/Ponivov9omCZb0S1AS29pvrDNh8hAB+b+IfcfELoqk=; b=bNB3lKsauKY7XWFKHL+GMJkzm7BisOoCMZ7Qcf182vtHStpR12tjzW8gyHv08A2M/F d2AoMBq8uCDK5gE1Irdn0WMQe0WRwmY9WUsD9VA221rmwvpTkoMivbYjqG+EmkpmZZWC vuznnOHXdnQIzq5azxWzvdLPNsU8B1PE9FmVrkaSV64qbzkZHSdeg9dkLuvQt7Aios4J uqk6TTTYVwViCW1ux/tw6j3FN9ORnbZEfXDbk1AMz/G29iYCi18SWlqrZSUHHooL8v1H zHmu8RRxtAuba/AVRgQJVjcsM5/hqwExt5FMC9UqpDxrHmVBF4P11N4OJEdQETWSrJNZ GRnw== 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=/Ponivov9omCZb0S1AS29pvrDNh8hAB+b+IfcfELoqk=; b=Arsxij+IsKxozK6sSQ9dt/FGtH0QVFFsA8RwqT7nIi6hefpQllireiZ/DhfbWoiqKx 0JctTa9dg+2KGUu7zxDPne5k8lB0rKodUAmrHClnHPjgPWnyW+SJje5JHhTLHuPx+WCu AbTpxm8yNW9Hm6D8sVlzSHnYUhHYBCRreGMQC/pr3eg17LWSCTQ81hLychn2fw3y9PnW KHQSOmHh4xh27qWUAtvVc8ko+xFO6L9MLbOvzRH1CBZ7d0m7vf7tCkBigTYrrruvygxM NZlEtlObICjXv7e1ZDWt/4Qp7yqtSrEVfT5cJJ/TygsYZrAaa+GKDl13tTgaxiIrBShN ScwA== X-Gm-Message-State: APt69E1BBPeOrg/+1ChTjLhe3YbDUPSWAgkEZNFBuM/CXdTpEB26/h6j CMsAr8hb1Fw98HWpDi+LNLqhHCbhe12KsyxokFqFEQ== X-Google-Smtp-Source: AAOMgpeU2Q5TMRm+gOI0V9YrvZ3SO7WUinpYTakHyo5Ne/eyVhWfTzcP1VojUDZV+wp+gOEWuWbpsTbrnLskKPaoodI= X-Received: by 2002:a17:902:bb05:: with SMTP id l5-v6mr24102980pls.246.1531220294865; Tue, 10 Jul 2018 03:58:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:b43:0:0:0:0 with HTTP; Tue, 10 Jul 2018 03:58:13 -0700 (PDT) In-Reply-To: <5B442A40.2040903@lab.ntt.co.jp> References: <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> <5B362B38.2000103@lab.ntt.co.jp> <5B3CB833.4040005@lab.ntt.co.jp> <5B3F4BAA.3050601@lab.ntt.co.jp> <5B4340E9.3030707@lab.ntt.co.jp> <5B434886.9010107@lab.ntt.co.jp> <5B442A40.2040903@lab.ntt.co.jp> From: Ashutosh Bapat Date: Tue, 10 Jul 2018 16:28:13 +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, Jul 10, 2018 at 9:08 AM, Etsuro Fujita wrote: > (2018/07/09 20:43), Ashutosh Bapat wrote: >>> >>> >>> I don't have any numbers right now, so that is nothing but a concern. But >>> as >>> I said in a previous email, in the approach I proposed, we don't need to >>> spend extra cycles where partitioning is not involved. I think that is a >>> good thing in itself. No? >> >> >> At the cost of having targetlist being type inconsistent. I don't have >> any testcase either to show that that's a problem in practice. So, >> it's a trade-off of a concern vs concern. > > > As I said before, I don't see any issue in having such a targetlist, but I > might be missing something, so I'd like to discuss a bit more about that. > Could you tell me the logic/place in the PG code where you think the problem > might occur. (IIRC, you mentioned something about that before (pathkeys? or > index-only scans?), but sorry, I don't understand that.) IIUC, index-only scan will be used when the all the required columns are covered by an index. If there is an index on the whole-row reference of the parent, it will be translated into a ConvertRowtypeExpr of the child when an index on the child is created. If the targetlist doesn't have ConvertRowtypeExpr, as your patch does, the planner won't be able to use such an index on the child table. But I couldn't create an index with a whole-row reference in it. So, I think this isn't possible right now. But in future if we allow creating index on whole-row reference or Pathkey points to an equivalence class, which contains equivalence members. A parent equivalence class member containing a whole-row reference gets translated into a child equivalence member containing a ConvertRowtypeExpr. At places in planner we match equivalence members to the targetlist entries. This matching will fail unexpectedly when ConvertRowtypeExpr is removed from a child's targetlist. But again I couldn't reproduce a problem when such a mismatch arises. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company