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 1fdCtg-0005tg-0I for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Jul 2018 11:03: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 1fdCte-0001xM-1h for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Jul 2018 11:02:58 +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 1fdCtd-0001xB-JC for pgsql-hackers@lists.postgresql.org; Wed, 11 Jul 2018 11:02:57 +0000 Received: from mail-pl0-x236.google.com ([2607:f8b0:400e:c01::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fdCtZ-00087k-DG for pgsql-hackers@postgresql.org; Wed, 11 Jul 2018 11:02:55 +0000 Received: by mail-pl0-x236.google.com with SMTP id c41-v6so9013779plj.10 for ; Wed, 11 Jul 2018 04:02:52 -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=+lBfmkUASe0kIiiu3uyII5i/jHgfY+Wp7zYW61Avveg=; b=IAW0Sao3sTuB5JL3FCYjreLnYAXIOKw9W/J5vHmB897yiMRrqhD5P/5xeflWvL1NZM i8jyrY+LzjFD1y+XrsMuzRbqIKOz94veOStGbxMPvJLdB3U3qRNau/hhJl9jAEgkEQWp ctbu1oBbpfX4IQRXIEkTFEeh1oG/7ozUAdp0fK7WxA3kVOcN+R4G0RY/epotDEgQSQSa fn0C3lK46U/P7K9h5/AFpRpNhh7wdqc/e6kFm95heYY4fYWpuJYQVrcG0OyQ0o3LFo8M 8aLzcXR6XKUDyuQe7cXsOVE/BcANiFXgvfTOdp15pavC0u4eU27/dQ9HWh1FQd8BL/fl 21NQ== 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=+lBfmkUASe0kIiiu3uyII5i/jHgfY+Wp7zYW61Avveg=; b=j1d325Qj4zNvBbFoCiw5DIysp8lv/uDYRjUApgAKEDEdyXI/cUKcKnd6LQEt2PWA/W 8m9LZHdYbQ3uQ24LvaYrECfSM5vU6Qt6DMRSVEPpF1nV9vH1SEK5HSM891mpd1hGKUJh aZQs8YdSPb2kJ0bvz5T3yPvnBmuq6RyVODM5RNh+iVSn1M0Ql/C9BvsPeZ6gfifRaKGl 4S1RXjR63yo5vaSN1XhConDKpQZAzSycAF8HZ3bTvDTmOACMdagpOVIgwBNTNamnAcG2 SMRr4m2BC8bwTgXcOqOOIjU4BC3e1gd2O1bxrhEDHys+NuKEeqVRGrCvEFe7Hz1/yz6J cyRA== X-Gm-Message-State: APt69E2xhRUq9qhp+5/GkzOITR10jRmZfVeHKGmh6XTTYrh3IjeRRjt1 ELyl4SnllcZoB3cLitGmrYrquCNihUtYw4+Yjahn/A== X-Google-Smtp-Source: AAOMgpdQgb/kavmYTa/QeS0ceer6aT+u6a1YkObEBZ5TNr7mmiwSXiCKTljP4zKUmkdKZRJjzRvfoRHZTuTl7f060TI= X-Received: by 2002:a17:902:8bc6:: with SMTP id r6-v6mr27705873plo.257.1531306971944; Wed, 11 Jul 2018 04:02:51 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:b43:0:0:0:0 with HTTP; Wed, 11 Jul 2018 04:02:50 -0700 (PDT) In-Reply-To: <5B45B777.7010502@lab.ntt.co.jp> References: <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> <5B45B777.7010502@lab.ntt.co.jp> From: Ashutosh Bapat Date: Wed, 11 Jul 2018 16:32:50 +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 Wed, Jul 11, 2018 at 1:23 PM, Etsuro Fujita wrote: > > > Actually, even if we could create such an index on the child table and the > targetlist had the ConvertRowtypeExpr, the planner would still not be able > to use an index-only scan with that index; because check_index_only would > not consider that an index-only scan is possible for that index because that > index is an expression index and that function currently does not consider > that index expressions are able to be returned back in an index-only scan. > That behavior of the planner might be improved in future, though. > >> 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. Right and when we do so, not having ConvertRowtypeExpr in the targetlist will be a problem. > > > I think so too. > >> 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. > > > IIUC, I don't think the planner assumes that for an equivalence member there > is an matching entry for that member in the targetlist; what I think the > planner assumes is: an equivalence member is able to be computed from > expressions in the targetlist. This is true. However, > So, I think it is safe to have whole-row > Vars instead of ConvertRowtypeExprs in the targetlist. when it's looking for an expression, it finds a whole-row expression so it think it needs to add a ConvertRowtypeExpr on that. But when the plan is created, there is ConvertRowtypeExpr already, but there is no way to know that a new ConvertRowtypeExpr is not needed anymore. So, we may have two ConvertRowtypeExprs giving wrong results. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company