Description
n8n-nodes-postgresql-copy
Custom n8n community node (developer: Firman Hanafi) to run PostgreSQL COPY TO / COPY FROM with streaming (CSV/TSV/custom delimiter) for bulk export/import.
Features
- COPY TO: export SELECT results to CSV/TSV/custom delimiter; header, quote/null, encoding options.
- COPY FROM: import CSV/TSV/custom delimiter from a binary property; header, column mapping, dry-run, skip errors.
- Streaming: avoids loading the whole file into memory.
- Uses n8n’s built-in Postgres credentials.
- n8n UI: Settings → Community Nodes → install
n8n-nodes-postgresql-copy. - CLI (in your n8n directory):
npm install n8n-nodes-postgresql-copy - Credentials: select Postgres (host, port, database, user, password, ssl).
- Operation:
- Copy To: JSON
{rowCount, fileSize, executionTimeMs, fileName, format}+ binary file (withmimeType,fileName,fileExtension). - Copy From: JSON
{success, table, rowsImported, rowsSkipped, errors, executionTimeMs, dryRun}. - For custom delimiter, fill
Custom Delimiter. Dry Runrolls back the transaction (no data written).- Ensure resources are sufficient for large files; COPY uses streaming but still needs memory headroom.
Installation
Node Configuration
– Copy To (Export): set Query, Output Format (csv/tsv/custom), File Name, Binary Property Name, header/quote/null/encoding options.
– Copy From (Import): set Table Name, Input Binary Field, Input Format (csv/tsv/custom), Has Header, Column Mapping, quote/null/skipErrors/dryRun options.
Output
Notes
Development
npm install
npm run build
npm test # requires devDependencies
License
MIT