Registry / database / postgres-copy

postgres-copy

JSON →
library1.0.0jsnpmunverified

A simple CLI tool written in Node.js for copying the contents of a PostgreSQL table from one database to another, including across different servers. Version 1.0.0 provides command-line options for source and target connections, with password prompts for security. It offers defaults and partial configuration to reuse source values. Key differentiators: lightweight, no dependencies beyond Node.js, explicitly handles cross-server copies.

npm install postgres-copy
INSTALL
IMPORT
SIG · POSTGRES-COPY
P
postgres-copy
databasejavascriptv1.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

postgres-copy
npx postgres-copy [options]
postgres-copy
The package is a CLI tool, not a library. Use `npx postgres-copy` to run directly without installing globally.
postgres-copy binary
npm install -g postgres-copy && postgres-copy [options]
require('postgres-copy')
This is a CLI tool, not a JavaScript module. Do not attempt to require it in code.

Copies rows from public.mytable in db1 to public.mytable_copy in db2, skipping confirmation prompt.

postgres-copy --source-url postgresql://localhost:5432/db1 --source-user postgres --source-password s3cret --source-table public.mytable --target-url postgresql://remote:5432/db2 --target-user admin --target-password pass --target-table public.mytable_copy --yes
Debug
Known issues
gotchaPasswords passed via CLI are visible in process listing and shell history.
fix
Omit password options to be prompted securely.
affects: >=1.0.0
gotchaCopying large tables without --yes will prompt for confirmation, blocking automation.
fix
Use --yes flag to skip prompts in scripts.
affects: >=1.0.0
gotchaTarget database must allow connections from the source's network; no SSH tunneling is provided.
fix
Set up network access (e.g., firewall rules, SSH tunnel) before running.
affects: >=1.0.0
gotchaThe tool does not validate table existence or schema compatibility before copying.
fix
Manually verify that both tables exist and have compatible columns.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Connection refused
Target database server is not reachable or port is blocked.
fix
Check target URL and network connectivity; ensure PostgreSQL is running.
error: password authentication failed for user
Incorrect password for source or target database user.
fix
Verify the password and provide correct --source-password or --target-password.
error: relation "public.mytable" does not exist
The specified source or target table does not exist in the database.
fix
Check table name and schema prefix (e.g., public.mytable).
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
postgres-copy — npm install postgres-copy · libregistry