It looks as if the display of function code in PgAdmin4 is not handling indentation properly, possibly due to TABS in the SQL.
Code that looks like if ..... then <TAB> if .... <TAB> then <TAB><TAB> ... <TAB>end if; end if; gets displayed as if ... then if ... then ... <<-- this line is not indented properly end if; end if; Is there a setting/preference for how to render TABS in the SQL display?