Обсуждение: proposal: Introduction a commontype as new polymorphic type

Поиск
Список
Период
Сортировка

proposal: Introduction a commontype as new polymorphic type

От
Pavel Stehule
Дата:
Hi

I am still little bit unhappy with missing functionality in our generic types.

If I write function fx(anyelement, anyelement) returns anyelement 

postgres=# create or replace function fx(anyelement, anyelement) returns anyelement 
as $$ select greather($1,$2) $$ language sql;
CREATE FUNCTION
postgres=# select fx(1,1.1);
ERROR:  function fx(integer, numeric) does not exist
LINE 1: select fx(1,1.1);
               ^
It fails on basic example.

What do you think about introduction new similar polymorphic type, that will use common type for real parameters?

some like

create or replace function fx(anyvalue, anyvalue) returns anyvalue
create or replace function fx(anyvalue[]) returns anyvalue

Using "any" and casting inside function has significant negative impact on performance 

Regards

Pavel