Hello,
rank_cd() seems to hang if ranking against a query in the form "!a|b".
Steps to reproduce:
# download the following file - 940K
http://www.develer.com/~piro/text.sql.bz2
# Create a new database
createdb --encoding=LATIN1 tsbug
# Load tsearch2 into the database
psql -f /usr/local/src/postgresql-8.2.4/contrib/tsearch2/tsearch2.sql tsbug
# Load the test data into the database
bzip2 -cd text.sql.bz2 | psql tsbug
# Connect to the database
psql tsbug
# Analyze
VACUUM ANALYZE;
# Perform the following query:
SELECT id, vector, rank_cd(vector, q)
FROM text, tsquery($$!'gatto' | 'volpe'$$) AS q
WHERE text.vector @@ q
ORDER BY id LIMIT 10;
The latter query hangs the server: it has to be restarted with pg_ctl -m
immediate. The query works if "rank_cd(vector, q)" is omitted from the query.
Notice that the ordering doesn't depend on the rank_cd result: does it mean
that rank_cd is effectively called 10 times only? Anyway if all but the first
10 rows are dropped from the table the above query doesn't trigger the bug.
Tested with PostgreSQL 8.2.4
--
Daniele Varrazzo - Develer S.r.l.
http://www.develer.com
|