AI Automation & Content Creation Services
ResourcesContact Us
← All blogs
Industry Insights

n8n Postgres Bulk Insert: How to Test the New COPY Option

The n8n 2.50 preview adds COPY to Postgres Insert. Learn how to stage a CSV import, verify the row count and handle duplicate records before going live.

By ZeroEmbedArticle date: 3 min read

The n8n 2.50.0 preview, released November 24, adds a bulk insert option to the Postgres node. In the Insert operation, enable Load Rows With COPY to load a batch into PostgreSQL and return a single row count. It is useful when you need to bring a large export into a staging table, but it changes what your workflow receives after the insert.

How do you test an n8n Postgres bulk insert?

Suppose you need to load a CRM export with 1,000 contacts. In a test workflow, parse a synthetic CSV into individual n8n items, normalize dates and blank values, and map only the fields you need. Include a stable source ID and the same import batch ID on all items. Use an isolated staging table so an import mistake cannot change live contacts.

Turn on COPY in the Postgres Insert node and run the batch. If all 1,000 rows are accepted, the node returns one item: {"rows":1000}. Query the staging table by batch ID and compare the total count and the number of distinct source IDs. A matching total alone will not tell you whether an ID appeared twice. If the next node expects one item per contact, keep track of the inputs separately or read the staged records back before continuing.

What happens if a row has a duplicate key?

Test a separate batch with a duplicate key on a staging column that has a unique constraint. In this implementation, a constraint error rejects the load instead of leaving the good rows behind. Confirm that the workflow does not move to the merge step or send a success notification after the failed insert. COPY mode hides Skip on Conflict, Output Columns and Query Batching, so do not rely on those settings while this option is active.

When should you keep using Insert or Upsert?

Use COPY for an append-only batch where a summary count is enough. Keep ordinary Insert if you need the results for each row or depend on its conflict handling. Use Upsert if the job is meant to update existing records. For a larger backfill, you can load and validate a staging batch first, then merge it into the destination by source ID. If the merge fails, keep the validated batch so you can retry that step without loading the file again.

Is the COPY option ready for a live workflow?

n8n marked 2.50.0 as a prerelease at publication. Before changing a live workflow, test a clean batch, a duplicate-key batch and an empty input on the exact version you intend to deploy. If a workflow depends on per-row output or the preview fails those checks, keep the insertion method you already trust.

ZeroEmbed