Postgresql Window Function Count Distinct