Docbug, SPI_getbinval, triger example

From: mlw <markw(at)mohawksoft(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Docbug, SPI_getbinval, triger example
Date: 2001-11-30 17:09:43
Message-ID: 3C07BD57.E43142B1@mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The docs suggest that this:

/* Get number of tuples in relation */
ret = SPI_exec("select count(*) from ttest", 0);

if (ret < 0)
elog(NOTICE, "trigf (fired %s): SPI_exec returned %d",
when, ret);

i = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc,
1, &isnull);
elog (NOTICE, "trigf(fired %s): there are %d tuples in ttest",
when, i);

When it should be:

pi = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc,
1, &isnull);
elog (NOTICE, "trigf(fired %s): there are %d tuples in ttest",
when, *pi);

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-11-30 17:29:31 Re: History question
Previous Message Nicolas Verger 2001-11-30 17:02:30 Re: [HACKERS] JDBC improvements