BUG #4479: Incorrect TSearch2 results when inserting after deleting

From: "Dan Fabulich" <dan(at)fabulich(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4479: Incorrect TSearch2 results when inserting after deleting
Date: 2008-10-15 02:08:12
Message-ID: 200810150208.m9F28CeS098801@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4479
Logged by: Dan Fabulich
Email address: dan(at)fabulich(dot)com
PostgreSQL version: 8.3.4
Operating system: OS X 10.5.5
Description: Incorrect TSearch2 results when inserting after deleting
Details:

Run the following psql script on Postgres 8.3.4. I've reproduced this on
Centos 5.2 and RhodiumToad on IRC reproduced the problem as well.

EXPECTED: The last two SELECT statements should return the same results (1
row)
ACTUAL: The final SELECT statement returns 0 results. The SELECT statement
just before it returns 1 result.

DROP DATABASE search_bug;
CREATE DATABASE search_bug;
\c search_bug

CREATE TABLE search_test (id bigserial PRIMARY KEY, name_search tsvector
default NULL, name_keywords varchar(255) default NULL);
CREATE INDEX name_search_index ON search_test USING gist(name_search);
create trigger name_search_update before update or insert on search_test for
each row execute procedure tsvector_update_trigger(name_search,
'pg_catalog.english', name_keywords);
SELECT * from search_test where name_search @@ to_tsquery('Noe');
-- should and does return nothing

INSERT INTO search_test (name_keywords) VALUES ('Noe Valley');

SELECT * from search_test where name_search @@ to_tsquery('Noe');
-- should and does return 1 row

DELETE from search_test where id = 1;

INSERT INTO search_test (name_keywords) VALUES ('Noe Valley');

SELECT * from search_test where name_search @@ to_tsquery('Noe');
-- should and does return 1 row

SELECT * from search_test where name_search @@ to_tsquery('Noe');
-- should return 1 row BUT RETURNS 0 ROWS; BUG!

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tony Marston 2008-10-15 09:41:19 Re: BUG #4465: GROUP BY is not to SQL standard
Previous Message Gregory Stark 2008-10-15 01:56:51 Re: BUG #4465: GROUP BY is not to SQL standard