Re: [HACKERS] interval / interval -> double operator

2007-05-29 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Andrew Hammond escribió: >> Which got me looking for "date_part". But that only seems to be in the >> gram.y file, include/catalog/pg_proc.h and the test suite. The pg_proc.h >> stuff looks pretty interesting, but to decipher it, I figured I need to read

Re: [HACKERS] interval / interval -> double operator

2007-05-29 Thread Alvaro Herrera
Andrew Hammond escribió: > Ok, I've been hunting through src/backend to try and find the code for > EXTRACT(epoch ...). I found EXTRACT in src/backend/parser/gram.y, which > seems like a reasonable place to start. > > | EXTRACT '(' extract_list ')' > { > FuncCall *n = makeNode(Func

Re: [HACKERS] interval / interval -> double operator

2007-05-29 Thread Andrew Hammond
On 5/18/07, Andrew Hammond <[EMAIL PROTECTED]> wrote: On 5/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: > > "Andrew Hammond" <[EMAIL PROTECTED]> writes: > > On 5/17/07, Tom Lane < [EMAIL PROTECTED]> wrote: > >> What are the grounds for defining it that way rather than some other > >> way? > > > Th

Re: [HACKERS] interval / interval -> double operator

2007-05-18 Thread Andrew Hammond
On 5/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Andrew Hammond" <[EMAIL PROTECTED]> writes: > On 5/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: >> What are the grounds for defining it that way rather than some other >> way? > The only alternative that came to mind when I wrote it was using a num

Re: [HACKERS] interval / interval -> double operator

2007-05-17 Thread Tom Lane
"Andrew Hammond" <[EMAIL PROTECTED]> writes: > On 5/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: >> What are the grounds for defining it that way rather than some other >> way? > The only alternative that came to mind when I wrote it was using a numeric > instead of float. No, I'm wondering what's

Re: [HACKERS] interval / interval -> double operator

2007-05-17 Thread Andrew Hammond
On 5/17/07, Tom Lane <[EMAIL PROTECTED]> wrote: Andrew Hammond <[EMAIL PROTECTED]> writes: > 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 IMMUTA

Re: [HACKERS] interval / interval -> double operator

2007-05-17 Thread Tom Lane
Andrew Hammond <[EMAIL PROTECTED]> writes: > 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

[HACKERS] interval / interval -> double operator

2007-05-17 Thread Andrew Hammond
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 OPER