server crash when tsearch2 function is called from update trigger

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: server crash when tsearch2 function is called from update trigger
Date: 2009-01-28 17:18:01
Message-ID: 162867790901280918h42706f83p2d922aecb11bd32a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

I found bug in tsearch2 module (8.3, 8.4).

\i /usr/local/pgsql83/share/contrib/tsearch2.sql
create table t(d varchar, fi public.tsvector);
CREATE TRIGGER fux BEFORE INSERT OR UPDATE ON fulltexttest FOR EACH
ROW EXECUTE PROCEDURE tsearch2('fi', 'description');

postgres=# INSERT INTO fulltexttest VALUES('Příliš žluťoučký kůň se
napil žluté vody',DEFAULT);
INSERT 0 1
postgres=# INSERT INTO fulltexttest VALUES('Příliš žluťoučký kůň se
napil žluté vody',DEFAULT);
INSERT 0 1
postgres=# INSERT INTO fulltexttest VALUES('Příliš žluťoučký kůň se
napil žluté vody',DEFAULT);
INSERT 0 1
postgres=# INSERT INTO fulltexttest VALUES('Příliš žluťoučký kůň se
napil žluté vody',DEFAULT);
INSERT 0 1
postgres=# SELECT * FROM fulltexttest ;
description |
fi
------------------------------------------+----------------------------------------------------------------------
Příliš žluťoučký kůň se napil žluté vody | 'kůň':3 'napil':5
'příliš':1 'se':4 'vody':7 'žluté':6 'žluťoučký':2
Příliš žluťoučký kůň se napil žluté vody | 'kůň':3 'napil':5
'příliš':1 'se':4 'vody':7 'žluté':6 'žluťoučký':2
Příliš žluťoučký kůň se napil žluté vody | 'kůň':3 'napil':5
'příliš':1 'se':4 'vody':7 'žluté':6 'žluťoučký':2
Příliš žluťoučký kůň se napil žluté vody | 'kůň':3 'napil':5
'příliš':1 'se':4 'vody':7 'žluté':6 'žluťoučký':2
(4 rows)

postgres=# update fulltexttest set description = description;
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: Failed.
!>

it's look like update trigger has different parameters then insert trigger

backtrace
(gdb) bt
#0 0x006a75cd in strncmp () from /lib/libc.so.6
#1 0x082aafc8 in namestrcmp (name=0xb5f09c40, str=0x7f7f7f7f <Address
0x7f7f7f7f out of bounds>) at name.c:252
#2 0x081c39bc in SPI_fnumber (tupdesc=0xb5f09c18, fname=0x7f7f7f7f
<Address 0x7f7f7f7f out of bounds>) at spi.c:699
#3 0x083023c2 in tsvector_update_trigger (fcinfo=0xbfa85c2c,
config_column=0 '\0') at tsvector_op.c:1270
#4 0x001203cd in tsa_tsearch2 (fcinfo=0xbfa85c2c) at tsearch2.c:394
#5 0x08180f3c in ExecCallTriggerFunc (trigdata=<value optimized out>,
tgindx=0, finfo=<value optimized out>, instr=0x0,
per_tuple_context=0x887a6e4) at trigger.c:1591
#6 0x0818409a in ExecBRUpdateTriggers (estate=0x8880d2c,
relinfo=0x8880db8, tupleid=0xbfa85f4a, newtuple=0x8881be0) at
trigger.c:2016
#7 0x081a2b1d in ExecUpdate (slot=0x8881048) at execMain.c:1909
#8 ExecutePlan () at execMain.c:1578
#9 standard_ExecutorRun (queryDesc=0x8880924,
direction=ForwardScanDirection, count=0) at execMain.c:308
#10 0x08264646 in ProcessQuery (plan=0x883b114, sourceText=0x883945c
"update t set d = d;", params=<value optimized out>, dest=0x883b190,
completionTag=0xbfa8611a "") at pquery.c:196
#11 0x08264877 in PortalRunMulti (portal=0x887e91c, isTopLevel=<value
optimized out>, dest=0x883b190, altdest=0x883b190,
completionTag=0xbfa8611a "") at pquery.c:1268
#12 0x08265054 in PortalRun (portal=0x887e91c, count=2147483647,
isTopLevel=100 'd', dest=0x883b190, altdest=0x883b190,
completionTag=0xbfa8611a "") at pquery.c:823
#13 0x0825fbf0 in exec_simple_query (query_string=0x883945c "update t
set d = d;") at postgres.c:991
#14 0x082614ac in PostgresMain (argc=4, argv=0x87ca528,
username=0x87ca4f8 "pavel") at postgres.c:3606
#15 0x0822c40f in BackendRun () at postmaster.c:3258
#16 BackendStartup () at postmaster.c:2872
#17 ServerLoop () at postmaster.c:1283
#18 0x0822d390 in PostmasterMain (argc=3, argv=0x87c7448) at postmaster.c:1031
#19 0x081cf5c6 in main (argc=3, argv=0x87c7448) at main.c:188
(gdb)

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Marshall, Steve 2009-01-28 17:34:49 Re: pg_listener entries deleted under heavy NOTIFY load only on Windows
Previous Message Euler Taveira de Oliveira 2009-01-28 02:07:20 Re: BUG #4632: Duplicate