interval / interval -> double operator

From: Andrew Hammond <andrew(dot)george(dot)hammond(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: interval / interval -> double operator
Date: 2007-05-17 22:45:58
Message-ID: 1179441957.460862.166380@p77g2000hsh.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Yet another potential addition to the family of operators. Some guy
was asking for it on IRC so...

CREATE OR REPLACE FUNCTION interval_over_interval(interval, interval)
RETURNS float STRICT IMMUTABLE LANGUAGE sql AS $$
SELECT extract(epoch from $1)::float / extract(epoch from $2);
$$;

CREATE OPERATOR /
( leftarg = interval
, rightarg = interval
, procedure = interval_over_interval
);

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-05-17 22:47:50 Re: Automatic adjustment of bgwriter_lru_maxpages
Previous Message Bruce Momjian 2007-05-17 22:44:24 Re: [HACKERS] Removing pg_auth_members.grantor (was Grantor name gets lost when grantor role dropped)