Postgres Funkcja rekurencyjna

CREATE OR REPLACE FUNCTION set_fun_compairecalender(_start_date timestamp without time zone DEFAULT now(), _company integer DEFAULT 2, _country integer DEFAULT 1)
 RETURNS timestamp without time zone
 LANGUAGE plpgsql
AS $function$
declare 
	dte timestamp;
begin
	
  select coalesce(hcl_date,'1900-01-01') into dte from holiday_calender hc where  hc.hcl_country = _country  and 
  hc.hcl_company  = _company  and hc.hcl_date::date = _start_Date::date;
	
  if coalesce(dte,'1900-01-01') <> '1900-01-01' then 
    -- Recursive function call at here
    select set_fun_compaireCalender into dte from set_fun_compaireCalender(dte::date + (' 1 day')::interval,_company,     _country);

  end if;

  return coalesce(dte,_start_Date)::date;

end
$function$
;
Satsara Gunaratne