0

I'm using pg module (and the promise version pg-promise-strict).

When I need to insert 1k records I must send to the server one by one.

I can't build a 1k record INSERT because my organization policies: the data MUST be sended separately (as seen in https://github.com/brianc/node-postgres/wiki/Client#method-query-parameterized)

I try to write a plsql function that does the bulk insert and send all the data in an array (or in a string, I try boths):

client.query("select bulk_insert", [allTheData], cb);

And I obtain the following message:

index row requires 38656 bytes, maximum size is 8191

Notes

  • The database is in other server
  • I only be able to connect with de postgres port
  • I'm not able to execute something like sh psql < "COPY..."

How can I do the bulk insert sending the data separately?

1 Answer 1

1

I think you should take a look to a plugin from the same author, as you database client library: https://github.com/brianc/node-pg-copy-streams which exactly made for COPY command.

Sign up to request clarification or add additional context in comments.

1 Comment

from json object rather than file !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.