Skip to content
Advertisement

Using placeholders with copy and pg-query-stream

I’m trying to extract a query as a csv file. I tried to use copy with pg-query-stream to execute the query but I’m facing this error:

error: bind message supplies 1 parameters, but prepared statement "" requires 0

when removing copy from the query it works fine with the placeholders also if I provided a query with copy and no placeholders it works fine.

JavaScript

JavaScript

Advertisement

Answer

There is a limitation there within the COPY context, which prohibits you from using any parameters.

But you can work-around that limitation, using pg-promise query formatting:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement