Created
May 5, 2022 09:41
-
-
Save malko/b455030fa408ba9369fd74a704a16f4a to your computer and use it in GitHub Desktop.
Psql imports useful commands
This file contains hidden or 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
-- deactivates all triggers and constraints | |
SET session_replication_role = replica; | |
-- restore triggers and constraints | |
SET session_replication_role = DEFAULT; | |
-- treat out-of-sync auto-increment sequence fields (use double quote arround table names to preserve uppercase letters) | |
SELECT pg_catalog.setval(pg_get_serial_sequence('"table_name"', 'id'), MAX(id)) FROM "table_name"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment