It's sometimes possible that the stop_datetime will be modified after a previous synchronization and constraining on start_datetime not being the same for the same person is reasonable.
Right now, this query returns rows (28 right now) when it shouldn't:
SELECT * FROM (
SELECT
count(*) AS count,
array_agg(id) AS entry_ids,
membership_id,
start_datetime,
array_agg(stop_datetime) AS stop_datetimes
FROM model.entry
GROUP BY membership_id, start_datetime
) t
WHERE count > 1
;
It's sometimes possible that the stop_datetime will be modified after a previous synchronization and constraining on start_datetime not being the same for the same person is reasonable.
Right now, this query returns rows (28 right now) when it shouldn't: