Re: Mysterious Bus Error with get_fn_expr_argtype()
| От | Brendan Jurd |
|---|---|
| Тема | Re: Mysterious Bus Error with get_fn_expr_argtype() |
| Дата | |
| Msg-id | 37ed240d0809012135k1a7621d5x2acf18b31c7f9281@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Mysterious Bus Error with get_fn_expr_argtype() ("David E. Wheeler" <david@kineticode.com>) |
| Список | pgsql-hackers |
On Tue, Sep 2, 2008 at 2:03 PM, David E. Wheeler <david@kineticode.com> wrote:
> BTW, anyone have any interest in this function in core? Its purpose is to
> return a string identifying the data type of its argument. It's useful for
> dynamically building queries to pass to PL/pgSQL's EXECUTE statement when
> you don't know the data types of values you're putting into the statement.
>
+1. I've been using a variation on this theme (it returns the type
OID, not a text value) for a couple of years. I find it very helpful
for troubleshooting queries where I need to track the cast/coercion
behaviour.
For the record, my version of the function is simply:
PG_FUNCTION_INFO_V1(gettype);
Datum gettype(PG_FUNCTION_ARGS)
{ PG_RETURN_OID(get_fn_expr_argtype(fcinfo->flinfo, 0));
}
CREATE OR REPLACE FUNCTION gettype(anyelement) RETURNS oid AS'libname', 'gettype'LANGUAGE C IMMUTABLE STRICT;
Cheers,
BJ
В списке pgsql-hackers по дате отправления: