From: | Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Bug in tsvector stats collection, fixed. |
Date: | 2008-11-27 21:18:39 |
Message-ID: | 492F0EAF.7000307@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
There was a small bug in the new compute_tsvector_stats function in CVS
HEAD, causing a crash with this surprisingly simple test case:
postgres=# CREATE TABLE tstest (ts tsvector);
CREATE TABLE
postgres=# INSERT INTO tstest values ('foobar');
INSERT 0 1
postgres=# ANALYZE tstest;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The crash happens here:
/* Grab the minimal and maximal frequencies that will get stored */
minfreq = sort_table[num_mcelem - 1]->frequency;
maxfreq = sort_table[0]->frequency;
Because the loop above this point suppresses items that occur only once,
num_mcelem is 0.
The fix is trivial, but I thought I'd post this test case anyway to get
it archived. The patch I committed moves the code above within the
"if(num_mcelem > 0)" block below that. The possibility that num_mcelem
can be zero was clearly thought of, but the check was too late.
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-11-27 21:49:23 | Re: Nested Loop Left Join always shows rows=1 |
Previous Message | Zdenek Kotala | 2008-11-27 21:15:43 | Re: Thread safety |