Re: Mysterious Bus Error with get_fn_expr_argtype()

Поиск
Список
Период
Сортировка
От David E. Wheeler
Тема Re: Mysterious Bus Error with get_fn_expr_argtype()
Дата
Msg-id DF7DA6D4-7F27-40B6-9A8E-1582B7934A5C@kineticode.com
обсуждение исходный текст
Ответ на Re: Mysterious Bus Error with get_fn_expr_argtype()  ("David E. Wheeler" <david@kineticode.com>)
Список pgsql-hackers
On Sep 2, 2008, at 10:43, David E. Wheeler wrote:

> Looks like regtype displays as an integer. So how about  
> pg_regtypeof() and pg_typeof()?

Sorry, make that:

PG_FUNCTION_INFO_V1(pg_regtypeof);

Datum
pg_regtypeof(PG_FUNCTION_ARGS)
{    PG_RETURN_OID(get_fn_expr_argtype(fcinfo->flinfo, 0));
}

PG_FUNCTION_INFO_V1(pg_typeof);

Datum
pg_typeof(PG_FUNCTION_ARGS)
{    Oid    typeoid;
    typeoid = get_fn_expr_argtype(fcinfo->flinfo, 0);    if (typeoid == InvalidOid) {        ereport(            ERROR,
(               errcode(ERRCODE_FEATURE_NOT_SUPPORTED),                errmsg("could not determine data type of
argumentto  
 
pg_typeof()")            )        );    }
PG_RETURN_DATUM(DirectFunctionCall1(textin,  
CStringGetDatum(format_type_be(typeoid))));
}

Best,

David



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

Предыдущее
От: "David E. Wheeler"
Дата:
Сообщение: Re: Mysterious Bus Error with get_fn_expr_argtype()
Следующее
От: "Neil Conway"
Дата:
Сообщение: Re: Window functions patch v04 for the September commit fest