Last active
December 30, 2015 15:09
-
-
Save holyketzer/7846527 to your computer and use it in GitHub Desktop.
PostgreSQL tricks
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
/* Get all sequences names */ | |
/* select pg_get_serial_sequence('table', 'key'); */ | |
select pg_get_serial_sequence('specializations', 'id'); | |
/* Change sequence last value */ | |
/* SELECT setval('sequence name', (SELECT MAX(key) FROM table)+1); */ | |
SELECT setval('public.specializations_id_seq', (SELECT MAX(id) FROM specializations)+1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment