Re: interval / interval -> double operator

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: interval / interval -> double operator
Дата
Msg-id 20070530002328.GK11630@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: interval / interval -> double operator  ("Andrew Hammond" <andrew.george.hammond@gmail.com>)
Ответы Re: interval / interval -> double operator  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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"


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Jaime Casanova"
Дата:
Сообщение: Re: Reviewing temp_tablespaces GUC patch
Следующее
От: Wang Haiyong
Дата:
Сообщение: Re: Help! DLL make faild under windows mingw.