unexpected query failure: ERROR: GIN indexes do not support whole-index scans

From: Jon Nelson <jnelson+pgsql(at)jamponi(dot)net>
To: pgsql-performance(at)postgresql(dot)org
Subject: unexpected query failure: ERROR: GIN indexes do not support whole-index scans
Date: 2010-10-18 20:59:26
Message-ID: AANLkTi=KzCrUTqZa_zXa8-T8afGbc9OCgAn7Ex2emnyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I have a table with an array column.
I added a GIN index to the array:

CREATE INDEX foo_idx ON t USING GIN (alternatecodes) WHERE
alternatecodes IS NOT NULL;

That's all well and good.
However, some queries started failing and I was able to reproduce the
behavior in psql!

SELECT * FROM t WHERE alternatecodes IS NOT NULL;
returns:
ERROR: GIN indexes do not support whole-index scans

Whaaa? Adding an *index* makes my /queries/ stop working? How can this be?
This really violated my principle of least surprise. If GIN indexes
don't support whole-index scans, fine, don't use them, but don't make
a perfectly valid query fail because of it.

This seems like a bug. Is it?

PostgreSQL version:

PostgreSQL 8.4.5 on x86_64-redhat-linux-gnu, compiled by GCC gcc
(GCC) 4.1.2 20080704 (Red Hat 4.1.2-48), 64-bit

--
Jon

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2010-10-18 23:01:10 Re: unexpected query failure: ERROR: GIN indexes do not support whole-index scans
Previous Message Josh Kupershmidt 2010-10-18 15:52:45 Re: how to get the total number of records in report