select * from claim_id_seq;
select * from claim_head_id_seq;
select * from claimant_id_seq;
select * from damage_id_seq;
select * from driver_id_seq;
select * from incident_id_seq;
select * from passenger_id_seq;
select * from person_id_seq;
select * from policy_id_seq;
select * from transaction_id_seq;
select * from vehicle_id_seq;
select * from witness_id_seq;

\set script_file `date +%Y%m%d%H%M%S` .sql
\t
\o :script_file
select 'alter sequence claim_id_seq restart '       || max(id) + 1 || ';' from claim;
select 'alter sequence claim_head_id_seq restart '  || max(id) + 1 || ';' from claim_head;
select 'alter sequence claimant_id_seq restart '    || max(id) + 1 || ';' from claimant;
select 'alter sequence damage_id_seq restart '      || max(id) + 1 || ';' from damage;
select 'alter sequence driver_id_seq restart '      || max(id) + 1 || ';' from driver;
select 'alter sequence incident_id_seq restart '    || max(id) + 1 || ';' from incident;
select 'alter sequence passenger_id_seq restart '   || max(id) + 1 || ';' from passenger;
select 'alter sequence person_id_seq restart '      || max(id) + 1 || ';' from person;
select 'alter sequence policy_id_seq restart '      || max(id) + 1 || ';' from policy;
select 'alter sequence transaction_id_seq restart ' || max(id) + 1 || ';' from transaction;
select 'alter sequence vehicle_id_seq restart '     || max(id) + 1 || ';' from vehicle;
select 'alter sequence witness_id_seq restart '     || max(id) + 1 || ';' from witness;
\o
\t
\i :script_file

select * from claim_id_seq;
select * from claim_head_id_seq;
select * from claimant_id_seq;
select * from damage_id_seq;
select * from driver_id_seq;
select * from incident_id_seq;
select * from passenger_id_seq;
select * from person_id_seq;
select * from policy_id_seq;
select * from transaction_id_seq;
select * from vehicle_id_seq;
select * from witness_id_seq;
