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 9B1C69FB22B for ; Fri, 28 Jul 2006 14:05:54 -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 63586-10 for ; Fri, 28 Jul 2006 14:05:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id ED8699FB1F2 for ; Fri, 28 Jul 2006 14:05:19 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from mail009.ownmail.com (unknown [203.199.110.93]) by svr4.postgresql.org (Postfix) with ESMTP id 9A7645AF04A for ; Fri, 28 Jul 2006 17:05:18 +0000 (GMT) Received: (from domains@localhost) by mail009.ownmail.com (8.12.11/8.12.10) id k6SH2Est002686; Fri, 28 Jul 2006 22:32:14 +0530 Date: Fri, 28 Jul 2006 22:32:14 +0530 Message-Id: <200607281702.k6SH2Est002686@mail009.ownmail.com> X-Originating-IP: 203.199.110.93 Reply-To: From: To: pgsql-interfaces@postgresql.org Subject: Re: SPI_getvalue gives a core dump MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.7 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO, NO_REAL_NAME X-Spam-Level: * Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200607/16 X-Sequence-Number: 6206 I have already tried it out. I tried the following:- char *myval 1) i = DatumGetInt64(SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull)); 2) myval=SPI_getvalue(trigdata->tg_trigtuple, tupdesc, 17); 3) myval=SPI_getvalue(trigdata->tg_trigtuple, trigdata->tg_relation->rd_att, 17); 4) myval=strdup(SPI_getvalue(trigdata->tg_trigtuple, trigdata->tg_relation->rd_att, 17)); 5) if ((myval=SPI_getvalue(trigdata->tg_trigtuple, trigdata->tg_relation->rd_att, 17))==NULL) then, log and exit. With warm regards. Vivek J. Joshi. vivek@staff.ownmail.com Trikon electronics Pvt. Ltd. All science is either physics or stamp collecting. -- Ernest Rutherford Tom Lane wrote: > > 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 > >---------------------------(end of broadcast)--------------------------- >TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly