Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 119331337B58 for ; Sun, 5 Dec 2010 13:26:55 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 28864-03 for ; Sun, 5 Dec 2010 17:26:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id C1CBA1337B54 for ; Sun, 5 Dec 2010 13:26:47 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oB5HQjJV026742; Sun, 5 Dec 2010 12:26:45 -0500 (EST) To: Andres Freund cc: pgsql-bugs@postgresql.org, Martin Atukunda Subject: Re: BUG #5784: CREATE INDEX USING GIN complains about array containing null values yet none exist In-reply-to: <201012051806.20719.andres@anarazel.de> References: <201012050650.oB56opvM090787@wwwmaster.postgresql.org> <201012051358.22813.andres@anarazel.de> <26122.1291567379@sss.pgh.pa.us> <201012051806.20719.andres@anarazel.de> Comments: In-reply-to Andres Freund message dated "Sun, 05 Dec 2010 18:06:20 +0100" Date: Sun, 05 Dec 2010 12:26:45 -0500 Message-ID: <26741.1291570005@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/41 X-Sequence-Number: 28847 Andres Freund writes: > On Sunday 05 December 2010 17:42:59 Tom Lane wrote: >> I think the reason the given example fails is just that it's all being >> done in one transaction. If the null-containing row were known dead >> it wouldn't get indexed. So: commit. > Um I doubt it. [ gets out gdb... ] Oh: the reason GIN is complaining is that it's just looking at ARR_HASNULL(), and the array's has-nulls flag is still set because we don't bother to try to clear it after replacing one element of the array. (Which in general would be an expensive thing to try to do...) If we were intending to leave GIN in its current nulls-hating state, the thing to do would be to replace the stupid ARR_HASNULL check with something more intelligent. But really it needs to be fixed to handle nulls properly, so I'm thinking that might be a dead-end patch. regards, tom lane