[PostgreSQL] Take backup of the individual table in postgres By Administrator on 8:13 PM in PostgreSQL, psql pg_dump -t <table-name> <database-name> > /tmp/file_name.dump Continue Reading Tweet
[PSQL]: Take Database Dump/Backup By Administrator on 5:36 AM in PostgreSQL, psql pg_dump dbname > outfile Continue Reading Tweet
PostgreSQL: Handling the sequence value in psql(Reset sequence/ Get sequence next value) By Administrator on 10:01 PM in PostgreSQL, psql PostgreSQL: Reset the sequence value of the table Example1 select setval('students_id_seq',1706); Result setval -------- 1706(1 row) =============================== Example2(Recommanded) To reset the sequence exactly to the recent primarykey id. This is the best idea to reset the sequence by avoiding usual conflicts. select setval('students_id_seq',(select max(id) from students)) Result setval -------- 1706(1 row) =============================== PostgreSQL: Get the next sequence value of the table select nextval('students_id_seq'); Result nextval --------- 1707(1 row) Continue Reading Tweet