tsearch2 problem rank_cd() (possibly) crashing postgres - Mailing list pgsql-admin

From Rajesh Kumar Mallah
Subject tsearch2 problem rank_cd() (possibly) crashing postgres
Date
Msg-id a97c77030612080255h131f708brb68495740219229a@mail.gmail.com
Whole thread Raw
Responses Re: tsearch2 problem rank_cd() (possibly) crashing postgres
List pgsql-admin
Hi ,

We recently upgraded from PostgreSQL 8.1.5 to PostgreSQL 8.2.0.
looks like rank_cd function is giving problem .

tradein_clients=> CREATE TABLE test (name text , name_vec tsvector);
CREATE TABLE
tradein_clients=> INSERT INTO test (name ,name_vec) values ('hello
world' , to_tsvector('hello world'));
INSERT 0 1
tradein_clients=> SELECT  name from test where name_vec @@
to_tsquery('hello') ;
+-------------+
|    name     |
+-------------+
| hello world |
+-------------+
(1 row)

tradein_clients=> SELECT  name, rank_cd(1,name_vec,
to_tsquery('hello')     ) as rank  from test where name_vec @@
to_tsquery('hello') ;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Succeeded.
tradein_clients=>

Analysis of core dump: (not sure though if its the right way of doing it)


$ gdb /opt/usr/local/pgsql/bin/postgres  core.2807

GNU gdb 5.3-25mdk (Mandrake Linux)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-mandrake-linux-gnu"...
Core was generated by `postgres: tradein tradein_clients 192.168.0.11(52876'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/i686/libm.so.6...done.
Loaded symbols for /lib/i686/libm.so.6
Reading symbols from /lib/i686/libc.so.6...done.
Loaded symbols for /lib/i686/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from
/mnt/disk3/opt/usr/local/postgresql820/lib/tsearch2.so...done.
Loaded symbols for /mnt/disk3/opt/usr/local/postgresql820/lib/tsearch2.so
#0  pg_detoast_datum (datum=0x1) at fmgr.c:1964
1964            if (VARATT_IS_EXTENDED(datum))
(gdb) bt
#0  pg_detoast_datum (datum=0x1) at fmgr.c:1964
#1  0x40c2a961 in rank_cd (fcinfo=0xbfffeda0) at rank.c:731
#2  0x0815948c in ExecMakeFunctionResult (fcache=0x8423c40, econtext=0x84239a8,
    isNull=0x8424c85 "\177~\177\177\177\177\177\034\210@\b\b",
isDone=0x8424c9c) at execQual.c:1147
#3  0x0815d373 in ExecTargetList (targetlist=0x8423c08,
econtext=0x84239a8, values=0x8424c70, isnull=0x8424c84 "",
    itemIsDone=0x8424c98, isDone=0xbffff068) at execQual.c:3981
#4  0x0815d672 in ExecProject (projInfo=0x8424bac, isDone=0xbffff068)
at execQual.c:4182
#5  0x0815d785 in ExecScan (node=0x8423b00, accessMtd=0x8169290
<SeqNext>) at execScan.c:143
#6  0x08169364 in ExecSeqScan (node=0x8423b00) at nodeSeqscan.c:130
#7  0x08157cb1 in ExecProcNode (node=0x8423b00) at execProcnode.c:349
#8  0x08155d5c in ExecutePlan (estate=0x842391c, planstate=0x8423b00,
operation=CMD_SELECT, numberTuples=0,
    direction=ForwardScanDirection, dest=0x83edfbc) at execMain.c:1081
#9  0x08154fbe in ExecutorRun (queryDesc=0x8423b00,
direction=ForwardScanDirection, count=0) at execMain.c:241
#10 0x081e5ee1 in PortalRunSelect (portal=0x840f96c, forward=1 '\001',
count=0, dest=0x83edfbc) at pquery.c:831
#11 0x081e5a91 in PortalRun (portal=0x840f96c, count=2147483647,
dest=0x83edfbc, altdest=0x83edfbc,
    completionTag=0xbffff320 "") at pquery.c:684
#12 0x081e1368 in exec_simple_query (
    query_string=0x83ed064 "SELECT  name, rank_cd(1,name_vec,
to_tsquery('hello')     ) as rank  from test where name_vec @@
to_tsquery('hello') ;") at postgres.c:939
#13 0x081e4932 in PostgresMain (argc=4, argv=0x83b09f4,
username=0x83b09c4 "tradein") at postgres.c:3419
#14 0x081bb396 in BackendRun (port=0x839e9a8) at postmaster.c:2926
#15 0x081babde in BackendStartup (port=0x839e9a8) at postmaster.c:2553
#16 0x081b8db7 in ServerLoop () at postmaster.c:1206
#17 0x081b822d in PostmasterMain (argc=1, argv=0x83937d8) at postmaster.c:958
#18 0x08177117 in main (argc=1, argv=0x1) at main.c:188
#19 0x40085c57 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)

pgsql-admin by date:

Previous
From: "Rajesh Kumar Mallah"
Date:
Subject: Re: problem in logging into database
Next
From: Oleg Bartunov
Date:
Subject: Re: tsearch2 problem rank_cd() (possibly) crashing postgres