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 t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com 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,

[HACKERS] polymorphic SQL functions has a problem with domains

2014-04-02 Thread Pavel Stehule
Hello 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; postgres=# select g(1::xx, 2::xx);

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

2014-04-02 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com 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

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 t...@sss.pgh.pa.us: Pavel Stehule pavel.steh...@gmail.com 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,

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

2014-04-02 Thread David Johnston
Tom Lane-2 wrote Pavel Stehule lt; pavel.stehule@ gt; 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

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

2014-04-02 Thread Tom Lane
David Johnston pol...@yahoo.com 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.

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 t...@sss.pgh.pa.us: David Johnston pol...@yahoo.com 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

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 pol...@yahoo.com 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

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

2014-04-02 Thread David Johnston
Tom Lane-2 wrote David Johnston lt; polobo@ gt; 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.

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 pol...@yahoo.com: 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