I wrote a function that turns tsvectors into tsqueries. I can't see any evident error and actually the function return the expected results but just for a strange set of queries. Otherwise it causes tsqueryout to exit with errors when the result is returned.
It seems that tsqueryout is running beyond what it should and most likely it could be some dirty memory/allocation issue. (ERROR: unrecognized operator type: or ERROR: stack depth limit exceeded) The queries that succede and the one that fail belong to a pretty curious set: SUCCEDE: select tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint) from catalog_items limit 2; -- q1 select itemid, tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint) from catalog_items; -- q2 select tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint) from catalog_items where itemid=10 or itemid=15 or itemid=27; -- q3 select tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint) from catalog_items order by random() limit 3; -- q4 FAIL: select tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint) from catalog_items limit 3; -- q5 If I compile my function with -O0 all queries succeed. Then I created a table create table tsvectors(i serial, tsv tsvector); in the same DB of catalog_items and filled it with some data. Length of tsvector is similar, just catalog_items contains more fields and records. All queries above succeeded. I then compiled from scratch postgresql with default configure options, loaded the whole DB containing catalog_items and no errors. Then I looked into configure options used by debian, copied nearly all with the exception of tcl stuff and rpath, compiled once more... tested my function and no error. I've no idea what to do next other than asking if someone can give a look to the code and check my comprehension of what a tsquery should be in memory. http://www.webthatworks.it/d1/files/ts_utilities.tar.bz2 thanks -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers