Hello since BOOL expression has three possible values: TRUE,FALSE,NULL plpgsql IF control structure should have three alternate blocks: THEN,ELSE,NULL shouldn't it ?
pgsql-sql by date:
Соглашаюсь с условиями обработки персональных данных