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

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: type info support functions for functions that use "any" type
Date: 2019-03-09 06:22:05
Message-ID: CAFj8pRARh+r4=HNwQ+hws-D6msus01Dw_6zjNYur6tPk1+W0rA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-03-09 06:51:57 Re: Ordered Partitioned Table Scans
Previous Message Pavel Stehule 2019-03-09 05:10:42 Re: \describe*