X-Original-To: pgsql-interfaces-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id AF8689FB1F2 for ; Fri, 28 Jul 2006 13:38:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 63238-01 for ; Fri, 28 Jul 2006 13:38:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6306E9FB22B for ; Fri, 28 Jul 2006 13:38:31 -0300 (ADT) 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 k6SGcR5O025295; Fri, 28 Jul 2006 12:38:27 -0400 (EDT) To: vivek@staff.ownmail.com cc: pgsql-interfaces@postgresql.org Subject: Re: SPI_getvalue gives a core dump In-reply-to: <200607281627.k6SGRwtM029266@mail009.ownmail.com> References: <200607281627.k6SGRwtM029266@mail009.ownmail.com> Comments: In-reply-to message dated "Fri, 28 Jul 2006 21:57:58 +0530" Date: Fri, 28 Jul 2006 12:38:27 -0400 Message-ID: <25294.1154104707@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.057 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/15 X-Sequence-Number: 6205 writes: > i = DatumGetInt64(SPI_getbinval(SPI_tuptable->vals[0], tupdesc, 1, &isnull)); I think this is your problem: you're trying to use the wrong tupdesc to retrieve from the SELECT count(*) result. SPI_tuptable->tupdesc would work better there. regards, tom lane