pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Using statement parameters with Copy API?
2+ messages / 2 participants
[nested] [flat]

* Using statement parameters with Copy API?
@ 2013-09-11 16:54  Jim Garrison <jim.garrison@nwea.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Jim Garrison @ 2013-09-11 16:54 UTC (permalink / raw)
  To: pgsql-jdbc

I want to use the copy API to execute a parameterized query, as in

COPY (SELECT * FROM TABLE WHERE KEY=?) TO STDOUT FORMAT BINARY

As far as I can tell it is not currently possible to prepare this statement and pass it to the copy API.

Is there a way to accomplish this other than just building the SQL with values already substituted?

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Using statement parameters with Copy API?
@ 2013-09-12 04:13  Kris Jurka <books@ejurka.com>
  parent: Jim Garrison <jim.garrison@nwea.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2013-09-12 04:13 UTC (permalink / raw)
  To: Jim Garrison <jim.garrison@nwea.org>; +Cc: pgsql-jdbc



On Wed, 11 Sep 2013, Jim Garrison wrote:

> 
> I want to use the copy API to execute a parameterized query, as in
> 
> COPY (SELECT * FROM TABLE WHERE KEY=?) TO STDOUT FORMAT BINARY
> 
> As far as I can tell it is not currently possible to prepare this statement
> and pass it to the copy API.
>  

This is a limitation of the server.  It doesn't accept parameterized COPY 
statements so the JDBC driver doesn't have a way to pass such a statement.  
Perhaps the driver could perform the text interpolation itself as it does 
in the V2 protocol, but that would also complicate the API if you wanted 
to have something similar to PreparedStatement.

Kris Jurka
-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2013-09-12 04:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-09-11 16:54 Using statement parameters with Copy API? Jim Garrison <jim.garrison@nwea.org>
2013-09-12 04:13 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox