Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-07 Thread Pavel Stehule
2014-04-02 17:19 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > I was informed about impossibility to use a polymorphic functions > together > > with domain types > > > see > > > create domain xx as numeric(15); > > > create or replace function g(anyelement, anyelement) > > returns anyelement

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Pavel Stehule
2014-04-02 18:34 GMT+02:00 David Johnston : > Tom Lane-2 wrote > > David Johnston < > > > polobo@ > > > > writes: > >> Does something like: > >> SELECT ($1 + $2)::$1%TYPE > >> exist where you can explicitly cast to the type of the input argument? > > > > I don't think SQL-language functions have s

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread David Johnston
Tom Lane-2 wrote > David Johnston < > polobo@ > > writes: >> Does something like: >> SELECT ($1 + $2)::$1%TYPE >> exist where you can explicitly cast to the type of the input argument? > > I don't think SQL-language functions have such a notation, but it's > possible in plpgsql, if memory serve

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Andres Freund
On 2014-04-02 12:27:30 -0400, Tom Lane wrote: > David Johnston writes: > > Does something like: > > SELECT ($1 + $2)::$1%TYPE > > exist where you can explicitly cast to the type of the input argument? > > I don't think SQL-language functions have such a notation, but it's > possible in plpgsql,

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Pavel Stehule
2014-04-02 18:27 GMT+02:00 Tom Lane : > David Johnston writes: > > Does something like: > > SELECT ($1 + $2)::$1%TYPE > > exist where you can explicitly cast to the type of the input argument? > > I don't think SQL-language functions have such a notation, but it's > possible in plpgsql, if memory

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Tom Lane
David Johnston writes: > Does something like: > SELECT ($1 + $2)::$1%TYPE > exist where you can explicitly cast to the type of the input argument? I don't think SQL-language functions have such a notation, but it's possible in plpgsql, if memory serves. regards, tom lane

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread David Johnston
Tom Lane-2 wrote > Pavel Stehule < > pavel.stehule@ > > writes: >> I was informed about impossibility to use a polymorphic functions >> together >> with domain types > >> see > >> create domain xx as numeric(15); > >> create or replace function g(anyelement, anyelement) >> returns anyelement

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Pavel Stehule
2014-04-02 17:19 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > I was informed about impossibility to use a polymorphic functions > together > > with domain types > > > see > > > create domain xx as numeric(15); > > > create or replace function g(anyelement, anyelement) > > returns anyelement

Re: [HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Tom Lane
Pavel Stehule writes: > I was informed about impossibility to use a polymorphic functions together > with domain types > see > create domain xx as numeric(15); > create or replace function g(anyelement, anyelement) > returns anyelement as > $$ select $1 + $2 $$ > language sql immutable; > po