Search Postgresql Archives

C function manipulating tsquery doesn't work with -O2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



http://psql.privatepaste.com/53cde5e24a

I've the above function.
Output is something like:

'9788876412646':A | ( '8876412646':A | ( 'edizioni':D | ( 'quasi':B
| ( 'estat':B | ( 'levi':C | ( 'lia':C | ( 'e/o':D |
'un':B ) ) ) ) ) ) )

It seems it always work with -O0

I can make it work with -O2 in:

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

As soon as I run
select tsvector_to_tsquery(ft1idx, '|', 'ABCD', 22::smallint)
  from catalog_items limit 3; -- q5

it commit seppuku in 2 ways:
ERROR:  unrecognized operator type: 50 (first run)
or
ERROR:  stack depth limit exceeded
HINT:  Increase the configuration parameter "max_stack_depth", after
ensuring the platform's stack depth limit is adequate.

This looks to happen in infix() tsquery.c

This doesn't seem to be related with length of the tsvector passed.

Crazily increasing the only palloc in the function (3x) doesn't
solve the problem.

This is what I get back from gdb once the function exit:
(gdb) backtrace
#0  0x000000000053739a in ?? ()
#1  0x0000000000536fd4 in ExecProject ()
#2  0x000000000053d150 in ExecScan ()
#3  0x0000000000536470 in ExecProcNode ()
#4  0x0000000000549ea0 in ExecLimit ()
#5  0x0000000000536458 in ExecProcNode ()
#6  0x0000000000534337 in ExecutorRun ()
#7  0x00000000005d6b2b in ?? ()
#8  0x00000000005d8339 in PortalRun ()
#9  0x00000000005d2de9 in ?? ()
#10 0x00000000005d4624 in PostgresMain ()
#11 0x00000000005a6c68 in ?? ()
#12 0x00000000005a7b30 in PostmasterMain ()
#13 0x000000000055aaae in main ()

version is:

PostgreSQL 8.3.9 on x86_64-pc-linux-gnu, compiled by GCC
gcc-4.3.real (Debian 4.3.2-1.1) 4.3.2

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux