Re: BUG #15842: Unable to run a prepared statement using the org.postgresql Java Library

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: mjb(at)bitflip(dot)software, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15842: Unable to run a prepared statement using the org.postgresql Java Library
Date: 2019-06-10 23:39:57
Message-ID: CAKFQuwb79U2Lm+MRr3OGoHMRAOAjjjNh+B+RKmMPYMMRkmDkEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Mon, Jun 10, 2019 at 4:24 PM PG Bug reporting form <
noreply(at)postgresql(dot)org> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 15842
> Logged by: Matthew James Briggs
> Email address: mjb(at)bitflip(dot)software
> PostgreSQL version: 10.7
> Operating system: Linux (Dockerhub postgres:10)
> Description:
>
>
This isn't a bug; you attempted to add question marks to a location where
they are not interpreted as parameters.

Basically you wrote:

SELECT 'let me say ? ? to you';

Which is a perfectly valid query that has zero input parameters and will
return:

"let me say ? ? to you"

It has no input parameters because the question marks you wrote are inside
a string literal.

The $$...$$ in your DO statement also denote a string literal.

I suggest you write an actual CREATE FUNCTION and then call that using:

SELECT function(?, ?)

David J.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thierry Husson 2019-06-10 23:45:38 Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)
Previous Message PG Bug reporting form 2019-06-10 23:23:24 BUG #15842: Unable to run a prepared statement using the org.postgresql Java Library