Postgresql – Identify groups of sequential records
I have very simple table: create table tmp( id int, source_id int, event_user varchar, event_date timestamp ); and here is the data: insert into tmp(id, source_id, event_user, event_date) values (1, 1, 'A', now()), (2, 1, 'A', now()+interval '1 day'), (3,…