Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 1294B9F9F75 for ; Fri, 8 Dec 2006 12:13:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 28698-02 for ; Fri, 8 Dec 2006 12:12:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C9BEE9FA040 for ; Fri, 8 Dec 2006 12:12:57 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kB8GCstL005965; Fri, 8 Dec 2006 11:12:54 -0500 (EST) To: "Joshua D. Drake" cc: pgsql-admin@postgresql.org, Oleg Bartunov , Teodor Sigaev Subject: Re: tsearch2 problem rank_cd() (possibly) crashing postgres In-reply-to: <1165593203.12459.81.camel@localhost.localdomain> References: <5485.1165592831@sss.pgh.pa.us> <1165593203.12459.81.camel@localhost.localdomain> Comments: In-reply-to "Joshua D. Drake" message dated "Fri, 08 Dec 2006 07:53:23 -0800" Date: Fri, 08 Dec 2006 11:12:54 -0500 Message-ID: <5964.1165594374@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/82 X-Sequence-Number: 23874 "Joshua D. Drake" writes: > On Fri, 2006-12-08 at 10:47 -0500, Tom Lane wrote: >> Nonetheless, dumping core on bad input is not acceptable behavior ... > Is it time to require test cases for contrib modules? tsearch2 *has* a regression test. ATM it sounds like the problem is that the OP tried to use a new library with old pg_proc entries that defined different parameter sets for the same-named C functions; a situation that no regression test would have exercised anyway. That change was probably unwise on Oleg and Teodor's part, but what's done is done. My point is that now that we know the failure mode, we need to add some defenses. The OP is certainly not the last DBA who will make this mistake during 8.1->8.2 upgrade. It looks to me like the problem is that with the old pg_proc entries, an "int4" will get passed where the code is expecting "float4[]", so it tries to dereference the int and crashes. There doesn't seem to be any real cheap defense --- we might have to add a get_fn_expr_argtype() call into rank_cd, and anything else that's been changed similarly. But I don't think this is negotiable. Backend crashes are bad. regards, tom lane