Re: SPI_prepare, SPI_execute_plan do not return rows when using parameters

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Jenkins <dennis(dot)jenkins(at)sbcglobal(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SPI_prepare, SPI_execute_plan do not return rows when using parameters
Date: 2005-10-05 19:41:17
Message-ID: 1865.1128541277@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dennis Jenkins <dennis(dot)jenkins(at)sbcglobal(dot)net> writes:
> My problem is that a query that should be returning a
> row is returning zero rows when I use a parametrized
> query.

You're passing the wrong parameter value, and probably not declaring it
to be the right type either. CHAROID is not the type you think it is
(BPCHAROID is what you want), and "CStringGetDatum" is not the way to
convert a C string into a char(N) datum. The most bulletproof way
to do the latter is to use DirectFunctionCall3 to invoke bpcharin().

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim C. Nasby 2005-10-05 19:48:14 Re: optimizing common subqueries
Previous Message Tom Lane 2005-10-05 19:11:11 Re: Problems with group by ... order by