From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Andrew Hammond <andrew(dot)george(dot)hammond(at)gmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: interval / interval -> double operator |
Date: | 2007-05-30 00:23:28 |
Message-ID: | 20070530002328.GK11630@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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(FuncCall);
> n->funcname = SystemFuncName("date_part");
> n->args = $3;
> n->agg_star = FALSE;
> n->agg_distinct = FALSE;
> n->location = @1;
> $$ = (Node *)n;
> }
>
> 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
> up on SystemFuncName().
That's where you got lost -- if you had looked at the pg_proc.h entries
more carefully you would have seen that they point to other functions,
like timestamptz_part and friends. You can find them on timestamp.c,
etc. The key is knowing that the pg_proc.h entry maps from a SQL
function name into a C function name.
--
Alvaro Herrera http://www.amazon.com/gp/registry/DXLWNGRJD34J
"La naturaleza, tan frágil, tan expuesta a la muerte... y tan viva"
From | Date | Subject | |
---|---|---|---|
Next Message | Wang Haiyong | 2007-05-30 00:47:30 | Re: Help! DLL make faild under windows mingw. |
Previous Message | Jaime Casanova | 2007-05-30 00:06:51 | Re: Reviewing temp_tablespaces GUC patch |