Created
June 8, 2017 14:16
-
-
Save gbuesing/5da671211a1e2ffefbf33c10e82bff08 to your computer and use it in GitHub Desktop.
Copy single row from one Postgres DB into another via psql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# database 1 | |
# output single row in format compatible with INSERT VALUES | |
\copy (SELECT * FROM users WHERE email = '[email protected]') 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