Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6ImL-0007pN-Jf for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Apr 2018 16:39:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f6ImK-0006Ej-HR for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Apr 2018 16:39:24 +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 1f6ImK-0006EZ-AS for pgsql-hackers@lists.postgresql.org; Wed, 11 Apr 2018 16:39:24 +0000 Received: from hook.sigaev.ru ([93.180.27.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f6ImH-0004B5-7z for pgsql-hackers@postgresql.org; Wed, 11 Apr 2018 16:39:23 +0000 Received: from xor.sai.msu.ru (unknown [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: teodor) by hook.sigaev.ru (Postfix) with ESMTPSA id 3C5A2B19192; Wed, 11 Apr 2018 19:39:20 +0300 (MSK) Subject: Re: Partitioned tables and covering indexes To: Amit Langote , Alexander Korotkov Cc: Jaime Casanova , Pg Hackers References: <48893c03-d1c8-62ef-b37d-b2f7dbdb8245@lab.ntt.co.jp> <994fa677-2dac-8fe5-3f39-024cd6406522@lab.ntt.co.jp> From: Teodor Sigaev Message-ID: <5ee72852-3c4e-ee35-e2ed-c1d053d45c08@sigaev.ru> Date: Wed, 11 Apr 2018 19:39:20 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.1 MIME-Version: 1.0 In-Reply-To: <994fa677-2dac-8fe5-3f39-024cd6406522@lab.ntt.co.jp> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Patch makes buildfarm almost red, patch is temporary reverted. Actually, discovered bug is not related to patch except new test faces with it, problem is: CompareIndexInfo() checks rd_opfamily for equality for all attributes, not only for key attribute. Obviously, CompareIndexInfo() needs more work: for (i = 0; i < info1->ii_NumIndexAttrs; i++) { if (maplen < info2->ii_KeyAttrNumbers[i]) Seems, we can go out from ii_KeyAttrNumbers array. Amit Langote wrote: > Hi. > > On 2018/04/11 0:36, Teodor Sigaev wrote: >>> ššš Does the attached fix look correct?š Haven't checked the fix with >>> ATTACH >>> ššš PARTITION though. >>> >>> >>> Attached patch seems to fix the problem.š However, I would rather get >>> rid of modifyingšstmt->indexParams.š That seems to be more logical >>> for me.š Also, it would be good to check some covering indexes on >>> partitioned tables.š See the attached patch. >> >> Seems right way, do not modify incoming object and do not copy rather >> large and deep nested structure as suggested by Amit. > > Yeah, Alexander's suggested way of using a separate variable for > indexParams is better. > >> But it willš be better to have a ATTACH PARTITION test too. > > I have added tests. Actually, instead of modifying existing tests, I > think it might be better to have a separate section at the end of > indexing.sql to test covering indexes feature for partitioned tables. > > Attached find updated patch. > > Thanks, > Amit > -- Teodor Sigaev E-mail: teodor@sigaev.ru WWW: http://www.sigaev.ru/