Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 43F611337B56 for ; Sun, 5 Dec 2010 13:06:32 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 10710-03 for ; Sun, 5 Dec 2010 17:06:25 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id AA5461337B50 for ; Sun, 5 Dec 2010 13:06:24 -0400 (AST) Received: from alap2.localnet (unknown [217.111.66.10]) by mail.anarazel.de (Postfix) with ESMTPSA id C07E8448005; Sun, 5 Dec 2010 18:06:22 +0100 (CET) From: Andres Freund To: Tom Lane Subject: Re: BUG #5784: CREATE INDEX USING GIN complains about array containing null values yet none exist Date: Sun, 5 Dec 2010 18:06:20 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.36-rc6-andres-00006-g4193d91; KDE/4.5.1; x86_64; ; ) Cc: pgsql-bugs@postgresql.org, Martin Atukunda References: <201012050650.oB56opvM090787@wwwmaster.postgresql.org> <201012051358.22813.andres@anarazel.de> <26122.1291567379@sss.pgh.pa.us> In-Reply-To: <26122.1291567379@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201012051806.20719.andres@anarazel.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.13 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_SORBS_WEB=0.77, T_FILL_THIS_FORM_SHORT=0.01, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/39 X-Sequence-Number: 28845 On Sunday 05 December 2010 17:42:59 Tom Lane wrote: > Andres Freund writes: > >> On Sunday 05 December 2010 13:07:23 Martin Atukunda wrote: > >>>> so, basically, the only way out of this would be to: > 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. test=# \i /tmp/test.sql DROP TABLE IF EXISTS t; DROP TABLE Time: 36.070 ms BEGIN; BEGIN Time: 0.122 ms CREATE TABLE t (id serial primary key, apps bigint[]); psql:/tmp/test.sql:3: NOTICE: 00000: CREATE TABLE will create implicit sequence "t_id_seq" for serial column "t.id" LOCATION: transformColumnDefinition, parse_utilcmd.c:341 psql:/tmp/test.sql:3: NOTICE: 00000: CREATE TABLE / PRIMARY KEY will create implicit index "t_pkey" for table "t" LOCATION: DefineIndex, indexcmds.c:438 CREATE TABLE Time: 102.843 ms INSERT INTO t (apps) VALUES ('{1,2,3,4}'); INSERT 0 1 Time: 0.408 ms INSERT INTO t (apps) VALUES ('{1,2,3,4}'); INSERT 0 1 Time: 0.111 ms INSERT INTO t (apps) VALUES ('{1,2,3,NULL}'); INSERT 0 1 Time: 0.127 ms UPDATE t SET apps[4] = -1 WHERE apps[4] IS NULL; UPDATE 1 Time: 0.271 ms COMMIT; COMMIT Time: 0.086 ms BEGIN; BEGIN Time: 0.192 ms CREATE INDEX t_apps_idx ON t USING GIN(apps); psql:/tmp/test.sql:18: ERROR: 22004: array must not contain null values LOCATION: ginarrayextract, ginarrayproc.c:53 COMMIT; ROLLBACK Time: 0.076 ms I remembered seeing that before.... Andres