Skip site navigation (1) Skip section navigation (2)

GIN overlap vs empty arrays

From: Jeff <threshar(at)torgo(dot)978(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: GIN overlap vs empty arrays
Date: 2010-03-25 14:54:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Ran into this and I'm trying to decide if this is functioning as  
designed or if this is a bug that should be fixed: (PG 8.4.2)

create table gintest
	idList int[],
	foo text

create index gintest_gin_idx on gintest using gin(idList gin__int_ops);

insert into gintest(idlist, foo) values (array[1,2,3], 'bar');

select * from gintest where idList && array[]::int[];

psql:ginproblem.sql:11: ERROR:  GIN indexes do not support whole-index  

I came across this in a production setting and widdled it down to  
this.  In a nutshell using overlap with an empty (not null) array  
causes this error.   Should there be a short circuit to bail on zero- 
length input to overlap since you can't overlap with nothing.  (if you  
pass in a plain null it works fine).

In the production setting it is tickled by the array being produced by  
a subselect that uses array_accum to gather a list of ids to pull up.

If this is the proper behavior I'll deal with it (in the end the  
result is the same - no rows).  Just a bit surprised by it.

Jeff Trout <jeff(at)jefftrout(dot)com>


pgsql-bugs by date

Next:From: bortdagosDate: 2010-03-25 15:13:34
Subject: BUG #5388: bortdagos
Previous:From: ALCALDIA DE INFANTE ALCALDIA DE INFANTEDate: 2010-03-25 14:51:31
Subject: Question about installation in 2003 server

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group