proposal: Introduction a commontype as new polymorphic type

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: Introduction a commontype as new polymorphic type
Date: 2017-04-04 07:11:56
Message-ID: CAFj8pRDBetUEp6nQRZmpxJHUZQQENAbLoozHWq-m10OyT8p+Ew@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2017-04-04 07:13:03 Re: Refactoring identifier checks to consistently use strcmp
Previous Message Tatsuo Ishii 2017-04-04 07:10:32 Re: Statement timeout behavior in extended queries