Re: tsearch2 and unexpected exists (Function defn)

Поиск
Список
Период
Сортировка
От Nigel J. Andrews
Тема Re: tsearch2 and unexpected exists (Function defn)
Дата
Msg-id Pine.LNX.4.21.0309071847020.1911-100000@ponder.fairway2k.co.uk
обсуждение исходный текст
Ответ на Re: tsearch2 and unexpected exists (Function defn)  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Ответы Re: tsearch2 and unexpected exists (Function defn)  ("Nigel J. Andrews" <nandrews@investsystems.co.uk>)
Список pgsql-general
Depressing how most of the replies in the this thread are from me and now I'm
doing another one :)


On Sat, 6 Sep 2003, Nigel J. Andrews wrote:

> On Sat, 6 Sep 2003, Nigel J. Andrews wrote:
>
> > On Sat, 6 Sep 2003, Nigel J. Andrews wrote:
> >
> > > On Thu, 4 Sep 2003, Teodor Sigaev wrote:
> > > >
> > > > Nigel J. Andrews wrote:
> > > > >
> > > > > This will be a little vague, it was last night and I can't now do the test in
> > > > > that db (see below) so can't give the exact wording.
> > > > >
> > > > > I seem to remember a report a little while ago about tsearch v2 causing
> > > > > unexpected backend exit messages with 7.3.4 and now I'm getting similar
> > > > > messages unpredictably and I can't find the thread in the archives either.
> > > > > ...
> > > >
> > > > Have you a core file, if yes then send gdb output, pls...


So I rebuilt with debugging and this is the backtrace:

(gdb) bt
#0  0x08173aa7 in pfree (pointer=0x82b28f0) at mcxt.c:480
#1  0x40a4f93c in to_tsquery_name (fcinfo=0xbfffe590) at query.c:840
#2  0x080d53f6 in ExecMakeFunctionResult (fcache=0x82b3cb8, arguments=0x82b2908, econtext=0x82b31f0, isNull=0xbfffe7d1
"", 
    isDone=0xbfffe6ec) at execQual.c:839
#3  0x080d58ee in ExecEvalFunc (funcClause=0x82b2878, econtext=0x82b31f0, isNull=0xbfffe7d1 "", isDone=0xbfffe6ec)
    at execQual.c:1167
#4  0x080d5f70 in ExecEvalExpr (expression=0x82b2878, econtext=0x82b31f0, isNull=0xbfffe7d1 "", isDone=0xbfffe6ec)
    at execQual.c:1715
#5  0x080d5121 in ExecEvalFuncArgs (fcinfo=0xbfffe740, argList=0x82b2860, econtext=0x82b31f0) at execQual.c:624
#6  0x080d51da in ExecMakeFunctionResult (fcache=0x82b3280, arguments=0x82b2860, econtext=0x82b31f0, isNull=0xbfffe88f
"", 
    isDone=0x0) at execQual.c:680
#7  0x080d5896 in ExecEvalOper (opClause=0x82b27e8, econtext=0x82b31f0, isNull=0xbfffe88f "", isDone=0x0) at
execQual.c:1125
#8  0x080d5f60 in ExecEvalExpr (expression=0x82b27e8, econtext=0x82b31f0, isNull=0xbfffe88f "", isDone=0x0)
    at execQual.c:1711
#9  0x080d60d6 in ExecQual (qual=0x82b2990, econtext=0x82b31f0, resultForNull=0 '\0') at execQual.c:1885
#10 0x080d65c3 in ExecScan (node=0x82b2440, accessMtd=0x80dc6d0 <SeqNext>) at execScan.c:124
#11 0x080dc77e in ExecSeqScan (node=0x82b2440) at nodeSeqscan.c:133
#12 0x080d4389 in ExecProcNode (node=0x82b2440, parent=0x82b20d8) at execProcnode.c:291
#13 0x080dbe37 in ExecNestLoop (node=0x82b20d8) at nodeNestloop.c:128
#14 0x080d43d9 in ExecProcNode (node=0x82b20d8, parent=0x0) at execProcnode.c:314
#15 0x080d32ee in ExecutePlan (estate=0x82b2e60, plan=0x82b20d8, operation=CMD_SELECT, numberTuples=10,
    direction=ForwardScanDirection, destfunc=0x81f6148) at execMain.c:958
#16 0x080d29c0 in ExecutorRun (queryDesc=0x82b2e38, estate=0x82b2e60, direction=ForwardScanDirection, count=10)
    at execMain.c:195
#17 0x080e0aa5 in _SPI_cursor_operation (portal=0x8292508, forward=1, count=10, dest=SPI) at spi.c:1417
#18 0x080e00e4 in SPI_cursor_fetch (portal=0x8292508, forward=1, count=10) at spi.c:860
#19 0x40a272d8 in exec_stmt_fors (estate=0xbfffec84, stmt=0x82a0810) at pl_exec.c:1339
#20 0x40a26c01 in exec_stmt (estate=0xbfffec84, stmt=0x82a0810) at pl_exec.c:914
#21 0x40a26a95 in exec_stmts (estate=0xbfffec84, stmts=0x82a0830) at pl_exec.c:858
#22 0x40a269eb in exec_stmt_block (estate=0xbfffec84, block=0x82a0998) at pl_exec.c:814
---Type <return> to continue, or q <return> to quit---
#23 0x40a25fba in plpgsql_exec_function (func=0x82a0040, fcinfo=0xbfffed50) at pl_exec.c:321
#24 0x40a23a1d in plpgsql_call_handler (fcinfo=0xbfffed50) at pl_handler.c:133
#25 0x080d5311 in ExecMakeFunctionResult (fcache=0x8298a58, arguments=0x8298578, econtext=0x82987b8, isNull=0xbfffeebf
"", 
    isDone=0xbfffeec0) at execQual.c:764
#26 0x080d58ee in ExecEvalFunc (funcClause=0x8298590, econtext=0x82987b8, isNull=0xbfffeebf "", isDone=0xbfffeec0)
    at execQual.c:1167
#27 0x080d5f70 in ExecEvalExpr (expression=0x8298590, econtext=0x82987b8, isNull=0xbfffeebf "", isDone=0xbfffeec0)
    at execQual.c:1715
#28 0x080d6269 in ExecTargetList (targetlist=0x82985b8, nodomains=1, targettype=0x8298800, values=0x82988b8,
    econtext=0x82987b8, isDone=0xbffff0ac) at execQual.c:2058
#29 0x080d64fb in ExecProject (projInfo=0x8298958, isDone=0xbffff0ac) at execQual.c:2282
#30 0x080dc583 in ExecResult (node=0x82985d0) at nodeResult.c:160
#31 0x080d4369 in ExecProcNode (node=0x82985d0, parent=0x0) at execProcnode.c:280
#32 0x080d32ee in ExecutePlan (estate=0x8298680, plan=0x82985d0, operation=CMD_SELECT, numberTuples=0,
    direction=ForwardScanDirection, destfunc=0x82989c8) at execMain.c:958
#33 0x080d29c0 in ExecutorRun (queryDesc=0x8298658, estate=0x8298680, direction=ForwardScanDirection, count=0)
    at execMain.c:195
#34 0x0812394b in ProcessQuery (parsetree=0x8296880, plan=0x82985d0, dest=Remote, completionTag=0xbffff240 "")
    at pquery.c:242
#35 0x08121e1d in pg_exec_query_string (query_string=0x8296518, dest=Remote, parse_context=0x828aa90) at postgres.c:838
#36 0x08122f30 in PostgresMain (argc=4, argv=0xbffff490, username=0x8256401 "cda") at postgres.c:2013
#37 0x0810a8fa in DoBackend (port=0x82562d0) at postmaster.c:2310
#38 0x0810a1ef in BackendStartup (port=0x82562d0) at postmaster.c:1932
#39 0x0810936c in ServerLoop () at postmaster.c:1009
#40 0x08108ec3 in PostmasterMain (argc=1, argv=0x8235bb0) at postmaster.c:788
#41 0x080e60ef in main (argc=1, argv=0xbffffe14) at main.c:210
(gdb)
(gdb) up
(gdb) p *name
$7 = {vl_len = 11, vl_dat = "d"}
(gdb) p (char *)name->vl_dat
$8 = 0x82b28f4 "default"
(gdb)

to_tsquery_name(PG_FUNCTION_ARGS) from tsearch2/query.c (below) obviously maps
to the to_tsquery(text,text) version of to_tsquery (given how the code looks
and fcinfo->flinfo->fn_oid) but, shouldn't that PG_FREE_IF_COPY be
PG_FREE_IF_COPY(name,0), note the 0 instead of 1?


Datum
to_tsquery_name(PG_FUNCTION_ARGS) {
    text *name=PG_GETARG_TEXT_P(0);
    Datum res= DirectFunctionCall2(
        to_tsquery,
        Int32GetDatum( name2id_cfg(name) ),
        PG_GETARG_DATUM(1)
    );

    PG_FREE_IF_COPY(name,1);
    PG_RETURN_DATUM(res);
}



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: v7.4b2 : How can I use COMMENT ON for Large Objects ?
Следующее
От: "Nigel J. Andrews"
Дата:
Сообщение: Re: tsearch2 and unexpected exists (Function defn)