SELECT all_ids AS missing_ids FROM generate_series((SELECT MIN(id) FROM your_table), (SELECT MAX(id) FROM your_table)) all_ids EXCEPT SELECT id FROM your_table