server crash when tsearch2 function is called from update trigger

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема server crash when tsearch2 function is called from update trigger
Дата
Msg-id 162867790901280918h42706f83p2d922aecb11bd32a@mail.gmail.com
обсуждение исходный текст
Ответы Re: server crash when tsearch2 function is called from update trigger  (Teodor Sigaev <teodor@sigaev.ru>)
Список 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=3D# INSERT INTO fulltexttest VALUES('P=C5=99=C3=ADli=C5=A1 =C5=BEl=
u=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se
napil =C5=BElut=C3=A9 vody',DEFAULT);
INSERT 0 1
postgres=3D# INSERT INTO fulltexttest VALUES('P=C5=99=C3=ADli=C5=A1 =C5=BEl=
u=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se
napil =C5=BElut=C3=A9 vody',DEFAULT);
INSERT 0 1
postgres=3D# INSERT INTO fulltexttest VALUES('P=C5=99=C3=ADli=C5=A1 =C5=BEl=
u=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se
napil =C5=BElut=C3=A9 vody',DEFAULT);
INSERT 0 1
postgres=3D# INSERT INTO fulltexttest VALUES('P=C5=99=C3=ADli=C5=A1 =C5=BEl=
u=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se
napil =C5=BElut=C3=A9 vody',DEFAULT);
INSERT 0 1
postgres=3D# SELECT * FROM fulltexttest ;
               description                |
      fi
------------------------------------------+--------------------------------=
--------------------------------------
 P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se napil=
 =C5=BElut=C3=A9 vody | 'k=C5=AF=C5=88':3 'napil':5
'p=C5=99=C3=ADli=C5=A1':1 'se':4 'vody':7 '=C5=BElut=C3=A9':6 '=C5=BElu=C5=
=A5ou=C4=8Dk=C3=BD':2
 P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se napil=
 =C5=BElut=C3=A9 vody | 'k=C5=AF=C5=88':3 'napil':5
'p=C5=99=C3=ADli=C5=A1':1 'se':4 'vody':7 '=C5=BElut=C3=A9':6 '=C5=BElu=C5=
=A5ou=C4=8Dk=C3=BD':2
 P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se napil=
 =C5=BElut=C3=A9 vody | 'k=C5=AF=C5=88':3 'napil':5
'p=C5=99=C3=ADli=C5=A1':1 'se':4 'vody':7 '=C5=BElut=C3=A9':6 '=C5=BElu=C5=
=A5ou=C4=8Dk=C3=BD':2
 P=C5=99=C3=ADli=C5=A1 =C5=BElu=C5=A5ou=C4=8Dk=C3=BD k=C5=AF=C5=88 se napil=
 =C5=BElut=C3=A9 vody | 'k=C5=AF=C5=88':3 'napil':5
'p=C5=99=C3=ADli=C5=A1':1 'se':4 'vody':7 '=C5=BElut=C3=A9':6 '=C5=BElu=C5=
=A5ou=C4=8Dk=C3=BD':2
(4 rows)

postgres=3D# update fulltexttest set description =3D 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=3D0xb5f09c40, str=3D0x7f7f7f7f <Address
0x7f7f7f7f out of bounds>) at name.c:252
#2  0x081c39bc in SPI_fnumber (tupdesc=3D0xb5f09c18, fname=3D0x7f7f7f7f
<Address 0x7f7f7f7f out of bounds>) at spi.c:699
#3  0x083023c2 in tsvector_update_trigger (fcinfo=3D0xbfa85c2c,
config_column=3D0 '\0') at tsvector_op.c:1270
#4  0x001203cd in tsa_tsearch2 (fcinfo=3D0xbfa85c2c) at tsearch2.c:394
#5  0x08180f3c in ExecCallTriggerFunc (trigdata=3D<value optimized out>,
tgindx=3D0, finfo=3D<value optimized out>, instr=3D0x0,
    per_tuple_context=3D0x887a6e4) at trigger.c:1591
#6  0x0818409a in ExecBRUpdateTriggers (estate=3D0x8880d2c,
relinfo=3D0x8880db8, tupleid=3D0xbfa85f4a, newtuple=3D0x8881be0) at
trigger.c:2016
#7  0x081a2b1d in ExecUpdate (slot=3D0x8881048) at execMain.c:1909
#8  ExecutePlan () at execMain.c:1578
#9  standard_ExecutorRun (queryDesc=3D0x8880924,
direction=3DForwardScanDirection, count=3D0) at execMain.c:308
#10 0x08264646 in ProcessQuery (plan=3D0x883b114, sourceText=3D0x883945c
"update t set d =3D d;", params=3D<value optimized out>, dest=3D0x883b190,
    completionTag=3D0xbfa8611a "") at pquery.c:196
#11 0x08264877 in PortalRunMulti (portal=3D0x887e91c, isTopLevel=3D<value
optimized out>, dest=3D0x883b190, altdest=3D0x883b190,
    completionTag=3D0xbfa8611a "") at pquery.c:1268
#12 0x08265054 in PortalRun (portal=3D0x887e91c, count=3D2147483647,
isTopLevel=3D100 'd', dest=3D0x883b190, altdest=3D0x883b190,
    completionTag=3D0xbfa8611a "") at pquery.c:823
#13 0x0825fbf0 in exec_simple_query (query_string=3D0x883945c "update t
set d =3D d;") at postgres.c:991
#14 0x082614ac in PostgresMain (argc=3D4, argv=3D0x87ca528,
username=3D0x87ca4f8 "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=3D3, argv=3D0x87c7448) at postmaster=
.c:1031
#19 0x081cf5c6 in main (argc=3D3, argv=3D0x87c7448) at main.c:188
(gdb)

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Euler Taveira de Oliveira
Дата:
Сообщение: Re: BUG #4632: Duplicate
Следующее
От: "Marshall, Steve"
Дата:
Сообщение: Re: pg_listener entries deleted under heavy NOTIFY load only on Windows