I wrote:
> I'm thinking there are two distinct bugs here.
Actually, make that three bugs. I was so focused on the crashing
that I failed to notice that ts_delete wasn't producing sane answers
even when it didn't crash:
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), '{smith,smith}'::text[]); ts_delete
---------------------'smith' 'foo' 'bar'
(1 row)
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), '{smith,foo}'::text[]); ts_delete
---------------'smith' 'bar'
(1 row)
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), '{bar,smith}'::text[]); ts_delete
---------------------'smith' 'foo' 'bar'
(1 row)
The non-array version is no better:
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), 'smith'::text); ts_delete
---------------------'smith' 'foo' 'bar'
(1 row)
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), 'foo'::text); ts_delete
---------------'smith' 'bar'
(1 row)
regression=# select ts_delete(array_to_tsvector('{smith,foo,bar}'::text[]), 'bar'::text); ts_delete
---------------------'smith' 'foo' 'bar'
(1 row)
I'm not sure if ts_delete takes its second argument as verbatim lexemes
or normalizes them first, but none of these words are changed by
to_tsvector, so either way it seems to fail to delete stuff it should.
regards, tom lane