proposal: Introduction a commontype as new polymorphic type - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal: Introduction a commontype as new polymorphic type
Date
Msg-id CAFj8pRDBetUEp6nQRZmpxJHUZQQENAbLoozHWq-m10OyT8p+Ew@mail.gmail.com
Whole thread Raw
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: Statement timeout behavior in extended queries
Next
From: Daniel Gustafsson
Date:
Subject: Re: Refactoring identifier checks to consistently use strcmp