- args:
    cascade: false
    read_only: false
    sql: "CREATE OR REPLACE FUNCTION public.search_payments(search text)\n RETURNS
      SETOF payments\n LANGUAGE plpgsql\n STABLE\nAS $function$\n\nBEGIN\n  if search
      = '' then\n    return query select * from payments ;\n  else \n    return query
      SELECT\n  p.*\nFROM\n  payments p, jobs j\nWHERE\np.jobid = j.id AND\n(\nsearch
      <% p.paymentnum OR\nsearch <% j.ownr_fn OR\nsearch <% j.ownr_ln OR\nsearch <%
      j.ownr_co_nm OR\nsearch <% j.ro_number OR\n  search <% (p.payer) OR\n  search
      <% (p.transactionid) OR\n  search <% (p.memo));\n  end if;\n\n\tEND\n$function$;"
  type: run_sql
