create or replace function dw.fx_nish() returns text language plpgsql as $$ declare x timestamp with time zone; y timestamp with time zone; begin x:= current_timestamp; perform pg_sleep(5); y:= current_timestamp; if x=y then return 'SAME'; else return 'DIFFERENT'; end if;