Обсуждение: timestamp_in DirectFunctionCall

Поиск
Список
Период
Сортировка

timestamp_in DirectFunctionCall

От
Marios Vodas
Дата:
Would this be correct?<br />DatumGetTimestamp(DirectFunctionCall3(timestamp_in, CStringGetDatum(time),
PointerGetDatum(0),Int32GetDatum(MAX_TIMESTAMP_PRECISION)));<br /><br />This is how timestamp_in starts, <b>#ifdef
NOT_USED</b>is a litle bit confusing.<br /> Datum timestamp_in(PG_FUNCTION_ARGS)<br />{<br />    char       *str =
PG_GETARG_CSTRING(0);<br/><br />#ifdef NOT_USED<br />    Oid            typelem = PG_GETARG_OID(1);<br />#endif<br
/>   int32        typmod = PG_GETARG_INT32(2);<br /> 

Re: timestamp_in DirectFunctionCall

От
Tom Lane
Дата:
Marios Vodas <mvodas@gmail.com> writes:
> This is how timestamp_in starts, *#ifdef NOT_USED* is a litle bit confusing.
> Datum timestamp_in(PG_FUNCTION_ARGS)
> {
>     char       *str = PG_GETARG_CSTRING(0);

> #ifdef NOT_USED
>     Oid            typelem = PG_GETARG_OID(1);
> #endif
>     int32        typmod = PG_GETARG_INT32(2);

The ifdef is just to document that timestamp_in is ignoring an input
function's standard second argument.

Personally I'd pass -1 for the third argument rather than hard-wiring
a specific value.
        regards, tom lane