Last active
August 29, 2015 13:57
-
-
Save joaquinmoreira/9392903 to your computer and use it in GitHub Desktop.
Export rows from a select and import back in postgresql
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
COPY (SELECT * FROM sample_table) TO '/path/to/file'; | |
COPY sample_table FROM '/path/to/file'; | |
SELECT setval('sample_table_id_seq', max(id)) FROM sample_table; -- Update primary key sequence |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment