Re: SPI_prepare, SPI_execute_plan do not return rows when using parameters - Mailing list pgsql-general

From Tom Lane
Subject Re: SPI_prepare, SPI_execute_plan do not return rows when using parameters
Date
Msg-id 1865.1128541277@sss.pgh.pa.us
Whole thread Raw
In response to SPI_prepare, SPI_execute_plan do not return rows when using parameters  (Dennis Jenkins <dennis.jenkins@sbcglobal.net>)
Responses Re: SPI_prepare, SPI_execute_plan do not return rows when using parameters  (Dennis Jenkins <dennis.jenkins@sbcglobal.net>)
List pgsql-general
Dennis Jenkins <dennis.jenkins@sbcglobal.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Problems with group by ... order by
Next
From: "Jim C. Nasby"
Date:
Subject: Re: optimizing common subqueries