https://github.com/freddez/pg-dump2insert
Fast PostgreSQL COPY dump to INSERT commands converter
https://github.com/freddez/pg-dump2insert
dump insert postgresql tool
Last synced: 3 months ago
JSON representation
Fast PostgreSQL COPY dump to INSERT commands converter
- Host: GitHub
- URL: https://github.com/freddez/pg-dump2insert
- Owner: freddez
- License: other
- Created: 2016-12-04T16:06:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-03-07T10:51:49.000Z (almost 4 years ago)
- Last Synced: 2025-09-20T08:58:21.867Z (3 months ago)
- Topics: dump, insert, postgresql, tool
- Language: Rust
- Size: 7.81 KB
- Stars: 45
- Watchers: 2
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
pg-dump2insert : Fast PostgreSQL COPY dump to INSERT commands converter
=======================================================================
PostgreSQL's pg_dump with *COPY* statements format is the most effective way to
backup and restore your database. However for retrieving specific data or to
inject dump into non-PostgreSQL database, *INSERT* commands are far more
convenient. This tool simply converts *COPY* dumps to *INSERT* dumps.
Installation
------------
This tool is written in `Rust `_ language. Install
it, then type::
cargo install
Usage
-----
Just pipe dump output to pg-dump2insert::
cat dump.sql | pg-dump2insert
If the dump file is a binary archive, use pg_restore::
pg_restore dump.db | pg-dump2insert
pg_restore -t tablenamedump.db | pg-dump2insert
Notice
------
The only difference with "--inserts" dumps is that all numeric values are quoted
in INSERTs (which is permitted in PostgreSQL), i.e.::
INSERT INTO tablename (id, ...) VALUES ('2', ...);
A (5 times slower) Python version is also provided.