--
-- to_interval/2
--
create or replace function to_interval(
  integer,
  character varying
) returns interval as $$
	
declare    
       interval__number	     alias for $1;
       interval__units	     alias for $2;
begin

	-- We should probably do unit checking at some point
	return ('''' || interval__number || ' ' || interval__units || '''')::interval;

end;$$ language plpgsql;