Wiktor Rzeczkowski <rzeczkow@mcmail.cis.mcmaster.ca> writes:
> (select k.bib from kw k where k.kword='concept')
> intersect
> (select k.bib from kw k where k.kword='of')
> intersect
> (select k.bib from kw k where k.kword='god');
> bib
> ---
> (0 rows)
> // THIS GIVES AN INCORRECT RESULT - see the following //
Yup. Nested intersect/except structures are buggy in 7.1.*. I believe
it's fixed for 7.2 however. If you are in a hurry for a fix, you could
try back-patching the most recent change depicted at
http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/prep/prepunion.c
regards, tom lane