Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Copy single row from one Postgres DB into another via psql
# database 1
# output single row in format compatible with INSERT VALUES
\copy (SELECT * FROM users WHERE email = 'me@example.com') To stdout With CSV force quote * null 'NULL' quote ''''
# database 2
# insert values outputted from above command into another database
INSERT INTO users VALUES (...);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment