There is already a patch for that (ignore/respect nulls in lead/lag): https://commitfest.postgresql.org/action/patch_view?id=1096 -- Vladimir
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных