Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YHFDn-0001qm-BZ for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Jan 2015 17:19:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YHFDm-0005Dd-Sl for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Jan 2015 17:19:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YHFDm-0005DX-5B for pgsql-bugs@postgresql.org; Fri, 30 Jan 2015 17:19:06 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YHFDe-0000oO-If for pgsql-bugs@postgresql.org; Fri, 30 Jan 2015 17:19:04 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 988C1290F3; Fri, 30 Jan 2015 09:18:55 -0800 (PST) Received: from EX13-CAS-013.vmware.com (EX13-CAS-013.vmware.com [10.113.191.65]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 945A6B06C3; Fri, 30 Jan 2015 09:18:55 -0800 (PST) Received: from [10.192.168.51] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.913.22; Fri, 30 Jan 2015 09:18:43 -0800 Message-ID: <54CBBCDC.6060009@vmware.com> Date: Fri, 30 Jan 2015 18:18:20 +0100 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Tom Lane CC: Michael Paquier , , Subject: Re: BUG #12694: crash if the number of result rows is lower than gin_fuzzy_search_limit References: <20150128181243.2579.80775@wrigleys.postgresql.org> <54CA3EB5.3030804@vmware.com> <4773.1422545177@sss.pgh.pa.us> <54CA57B9.3070602@vmware.com> <6517.1422547480@sss.pgh.pa.us> <54CA74D3.3090102@vmware.com> <25919.1422561570@sss.pgh.pa.us> In-Reply-To: <25919.1422561570@sss.pgh.pa.us> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -6.9 (------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 01/29/2015 08:59 PM, Tom Lane wrote: > Heikki Linnakangas writes: >> For master and 9.4, I'm thinking of applying the attached. It makes it >> clear that startScan() is not used to re-start a scan with existing scan >> keys, but is always called on a newly initialized scan keys. > > Looks reasonable to me, but should ginFreeScanKeys() null out the pointers > after freeing them, to be sure we find any incorrect accesses? It might > not be worth the trouble; but if you have any doubts at all about the > order of operations this seems like a good safety feature. Nah, I'm not worried about that. ginFreeScanKeys() frees the whole 'keys' array, so we'd have bigger problems if there was a reference-after-free. > Also, in the department of nitpicks, I'd do this: > > { > IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); > + GinScanOpaque so = (GinScanOpaque) scan->opaque; > TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); > int64 ntids; > > more like this: > > { > IndexScanDesc scan = (IndexScanDesc) PG_GETARG_POINTER(0); > TIDBitmap *tbm = (TIDBitmap *) PG_GETARG_POINTER(1); > + GinScanOpaque so = (GinScanOpaque) scan->opaque; > int64 ntids; > > I think of the PG_GETARG calls as being an ugly stepchild of a proper > function header declaration, and as such, they should come first unless > there is an unavoidable reason not to. Ok, committed with that fix. - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs