select
    case
        when y.next_sequence > x.max_id 
        then 'Success. Incident sequence reset correctly.'
        else 
            'Fail. Max incident.id = ' || 
            x.max_id || 
            ', next sequence = ' || 
            next_sequence || '.'
    end as test_result
from
    (select max(id) as max_id from incident) x,
    (select nextval('incident_id_seq') as next_sequence) y;