How currval of sequence being preserved during the backup and restore in postgres If I do backup and restore a huge db (tons of tables in it), will it run without any issues rather rising exception about duplicate key constraints of sequenced column(s).

While taking pg_dump (complete schema / db), how its taking the individual value of a sequence and altering the value with latest value of a table's sequenced column when we do restore?
If you look at the SQL script generated by pg_dump you will see that it generates a setval() call for each sequence exported. So if you have a sequence test_seq and the last value it generated was 42, you will see this line in the SQL script:

SELECT pg_catalog.setval('public.test_seq', 42, true); 


this makes the sequence return 43, the next time nextval() is called.

See the manual for details on the setval() function.