Re: proposal: type info support functions for functions that use"any" type

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: type info support functions for functions that use"any" type
Дата
Msg-id CAFj8pRBkUJ81khSVTEcZfxGd75F9zNjdfkhfXBkjjyF-3w285Q@mail.gmail.com
обсуждение исходный текст
Ответ на proposal: type info support functions for functions that use "any" type  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: proposal: type info support functions for functions that use "any" type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi

so 9. 3. 2019 v 7:22 odesílatel Pavel Stehule <pavel.stehule@gmail.com> napsal:
Hi,

Tom introduced supported functions for calculation function's selectivity. Still I have similar idea to use supported function for calculation function's parameter's types and function return type.

Motivation:

Reduce a necessity of overloading of functions. My motivation is related primary to Orafce, but this feature should be helpful for anybody with similar goals. The function's overloading is great functionality but it is hard for maintenance.

My idea to enhance a CREATE FUNCTION command to be able do

CREATE FUCNTION foo("any")
RETURNS "any" AS ...
TYPEINFO foo_typeinfo

CREATE FUNCTION decode(VARIADIC "any")
RETURNS "any" AS ...
TYPEINFO decode_typeinfo.

The typeinfo functions returns a pointer tu structure with param types and result type. Only function with "any" parameters or "any" result can use TYPEINFO supported function. This functionality should not be allowed for common functions.

This functionality is limited just for C coders. But I expect so typical application coder doesn't need it. It doesn't replace my proposal of introduction other polymorphic type - now named "commontype" (can be named differently). The commontype is good enough solution for application coders, developers.

Comments, notes?

here is a patch

I have not a plan to push decode function to upstream. Patch contains it just as demo.

Regards

Pavel
 

Regards

Pavel


Вложения

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Re: A separate table level option to control compression
Следующее
От: Julien Rouhaud
Дата:
Сообщение: Re: Checksum errors in pg_stat_database