SELECT user_id
FROM (
SELECT user_id,
YEARWEEK(datetime, 1) AS year_week,
COUNT(DISTINCT YEARWEEK(datetime, 1)) AS weeks_count
FROM your_table
GROUP BY user_id, YEARWEEK(datetime, 1)
) AS user_weeks
GROUP BY user_id
HAVING COUNT(DISTINCT year_week) = (
SELECT COUNT(DISTINCT YEARWEEK(datetime, 1))
FROM your_table
);
Но столкнулся с тем, что пропускается такое:
Username™
SELECT reltuples FROM pg_class WHERE relname = "table"