--
-- age/1
--
create or replace function age(
  xid
) returns int4 as $$
xid_age$$ language plpgsql;


--
-- age/2
--
create or replace function age(
  timestamp with time zone,
  timestamp with time zone
) returns interval as $$
timestamptz_age$$ language plpgsql;


--
-- age/1
--
create or replace function age(
  timestamp with time zone
) returns interval as $$
select pg_catalog.age(cast(current_date as timestamp with time zone), $1)$$ language plpgsql;


--
-- age/2
--
create or replace function age(
  timestamp without time zone,
  timestamp without time zone
) returns interval as $$
timestamp_age$$ language plpgsql;


--
-- age/1
--
create or replace function age(
  timestamp without time zone
) returns interval as $$
select pg_catalog.age(cast(current_date as timestamp without time zone), $1)$$ language plpgsql;