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 1fGcou-0005av-Vu for pgsql-hackers@arkaria.postgresql.org; Thu, 10 May 2018 04:04: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 1fGcos-0006PH-SO for pgsql-hackers@arkaria.postgresql.org; Thu, 10 May 2018 04:04:42 +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 1fGcos-0006P7-Gz for pgsql-hackers@lists.postgresql.org; Thu, 10 May 2018 04:04:42 +0000 Received: from mail-pl0-x22a.google.com ([2607:f8b0:400e:c01::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fGcom-0003Xx-Sp for pgsql-hackers@postgresql.org; Thu, 10 May 2018 04:04:41 +0000 Received: by mail-pl0-x22a.google.com with SMTP id c11-v6so510580plr.5 for ; Wed, 09 May 2018 21:04:36 -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=UYlbM09z/CzZra0hp3CuLtkYpkk6BrzeTKqXyYocp4s=; b=1j7kl4zz2Ah0au6NA0qT8xvONBg93uEBPXi3FMfL0EKqv7p83HuleWwA1iEVESe/Gf HkvIXBVy7g9p60bFCNgMy8cDvOmzklzOGfIdpcHrrB7N3taH8HDGXpIGglH4lv1JVJdr eD0EFGeV4cxft9DU52aZH8Vj6wkHRVLC6LPJBxzskfTWzuleDIMAl7wzQKVfaLrTzuYz NrH/yhE3oZN01wwzOMxUBnrAwXs48/0iTvHycCZuMBhWN5oSv9KzdFNPcIH6CWUI+WsY QMzma6/h9avoIJ8JMtWJM1XhyBC4We6WZPuVeo6uPgiSRnIthLvjQCfCdz9LXqyYWY96 EEbw== 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=UYlbM09z/CzZra0hp3CuLtkYpkk6BrzeTKqXyYocp4s=; b=WdT/mxVb5r1/wMfM8eptG8E3o2Da1M4gM5MO0mR2qjrvDhQrGABEchd290daykPEIB zhPFJmMxdQQznIgjp4mEfAs2uIZPWv3nFvhSWQXkSwWJPIleXqa1NCEOaZ4yxZc6fiHs GeLWGlYjVufX9bFSes9MrGmvUtlPZKwMlXBtlckO73WUt5G0Tp5q5CZsj1Rkawge+BCI 4r6LDLvL0cEogUz27ew3ghxKjh+yVKzy/mcBb0Pncw+/qmME20xtTS0eLkPoV++NLvOt MdpoVlPGteFD/nIOPMM2Roaw89U0GpPTJflKpUXUOl998lr/H63DlpsY1cfcq0n8SayR IdNQ== X-Gm-Message-State: ALQs6tAXauBM0Oe6f8WoDz+eHecMbQCyQXJNXhiIKXoV18tUhNQS1foT IjDtKEK8iZdv4JEN57SF+7C2W7cVGU7Lrt9mjps4rg== X-Google-Smtp-Source: AB8JxZoZ2UoJTP81EAuRwOsdSPHcIwVzlRvjX5jUmIr07DN35u3TMehbVBYPGyphWNuRurD6X28lzy8PwLjFosGFj94= X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr38625716pld.118.1525925074102; Wed, 09 May 2018 21:04:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.138.194 with HTTP; Wed, 9 May 2018 21:04:33 -0700 (PDT) In-Reply-To: <5AF2E09F.9060208@lab.ntt.co.jp> References: <5AD5B1E0.8020404@lab.ntt.co.jp> <5AD5C5A1.1070509@lab.ntt.co.jp> <5ADF12D1.1030406@lab.ntt.co.jp> <5AE1C0D3.5060009@lab.ntt.co.jp> <5AE84FBF.3040905@lab.ntt.co.jp> <5AF2E09F.9060208@lab.ntt.co.jp> From: Ashutosh Bapat Date: Thu, 10 May 2018 09:34:33 +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, May 9, 2018 at 5:20 PM, Etsuro Fujita wrote: > > (2018/04/25 18:51), Ashutosh Bapat wrote: >> Actually I noticed that ConvertRowtypeExpr are used to cast a child's >> whole row reference expression (not just a Var node) into that of its >> parent and not. For example a cast like NULL::child::parent produces a >> ConvertRowtypeExpr encapsulating a NULL constant node and not a Var >> node. We are interested only in ConvertRowtypeExprs embedding Var >> nodes with Var::varattno = 0. I have changed this code to use function >> is_converted_whole_row_reference() instead of the above code with >> Assert. In order to use that function, I had to take it out of >> setrefs.c and put it in nodeFuncs.c which seemed to be a better fit. > > This change seems a bit confusing to me because the flag bits > "PVC_INCLUDE_CONVERTROWTYPES" and "PVC_RECURSE_CONVERTROWTYPES" passed to > pull_var_clause look as if it handles any ConvertRowtypeExpr nodes from a > given clause, but really, it only handles ConvertRowtypeExprs you mentioned > above. To make that function easy to understand and use, I think it'd be > better to use the IsA(node, ConvertRowtypeExpr) test as in the first version > of the patch, instead of is_converted_whole_row_reference, which would be > more consistent with other cases such as PlaceHolderVar. I agree that using is_converted_whole_row_reference() is not consistent with the other nodes that are handled by pull_var_clause(). I also agree that PVC_*_CONVERTROWTYPES doesn't reflect exactly what's being done with those options. But using is_converted_whole_row_reference() is the correct thing to do since we are interested only in the whole-row references embedded in ConvertRowtypeExpr. There can be anything encapsulated in ConvertRowtypeExpr(), a non-shippable function for example. We don't want to try to push that down in postgres_fdw's case. Neither in other cases. So, it boils down to changing names of PVC_*_CONVERTROWTYPES to something more meaningful. How about PVC_*_CONVERTWHOLEROWS? -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company