Re: generic builtin functions

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: generic builtin functions
Дата
Msg-id 20051110204239.GK19686@svana.org
обсуждение исходный текст
Ответ на Re: generic builtin functions  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers
On Thu, Nov 10, 2005 at 03:28:55PM -0500, Andrew Dunstan wrote:
> Eek! I would be prepared to go to quite a lot of trouble to avoid that.
>
> My idea was to have the functions that need access to the text values
> look up fcinfo->flinfo->fn_oid and then use that to look up the type
> info. But that would mean we would need pg_proc entries for these
> functions for each enum, even if it's the same function underneath,
> wouldn't it?

There are functions in the backend already to help you:
  argoid = procLookupArgType( fcinfo->flinfo->fn_oid, 0 );

returns the OID of the type of your first arguments.
  returnoid = procLookupRettype( fcinfo->flinfo->fn_oid );

returns your return type. These work even if you are in a type
input/output function.

Here is some code that uses these:

http://svana.org/kleptog/pgsql/taggedtypes.html

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: generic builtin functions
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: generic builtin functions