alexandrainst / alexandrainst/node-red-contrib-postgresql

Add option for batch insert

Open
#45 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
HTML
Stars
38
Forks
12
Avg merge
4h 1m
Merged PRs (30d)
2

Description

Based on https://node-postgres.com

There are a few different approaches to consider:

Copy streams: https://github.com/brianc/node-pg-copy-streams

Multiple executes:

CREATE TABLE person (
  id SERIAL PRIMARY KEY,
  name TEXT,
  age INTEGER
);

--

PREPARE insert_person_plan (text, integer) AS
INSERT INTO person (name, age)
VALUES ($1, $2);

BEGIN;
EXECUTE insert_person_plan('Alice', 25);
EXECUTE insert_person_plan('Bob', 30);
EXECUTE insert_person_plan('Charlie', 35);
COMMIT;

{
	"execute": {
		"insert_person_plan": [
			["Alice", 25],
			["Bob", 30],
			["Charlie", 35],
		]
	}
}

--

DEALLOCATE insert_person_plan;

SELECT * FROM person;

DROP TABLE person;

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides no file or test entry point. Start by comparing the proposed copy-streams approach with multiple prepared executes, using the node-postgres and node-pg-copy-streams references, then define the supported batch-insert behavior and acceptance tests before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.