Re: INOUT parameters in procedures

2018-03-20 Thread Merlin Moncure
On Tue, Mar 20, 2018 at 4:19 PM, Merlin Moncure wrote: > A) you can't assign output variables with into: > CALL p(1) INTO i; // gives syntax error > > B) you can't assign via assignment > i := p(1); // gives error, 'use CALL' > > C) but you *can* via execute > EXECUTE 'CALL p(1)' INTO i; // this

Re: INOUT parameters in procedures

2018-03-20 Thread Merlin Moncure
On Tue, Mar 20, 2018 at 10:09 AM, Pavel Stehule wrote: > 2018-03-20 15:18 GMT+01:00 Merlin Moncure : >> >> postgres=# create or replace procedure p(a inout int default 7) as $$ >> >> begin return; end; $$ language plpgsql; >> >> CREATE PROCEDURE >> >> Time: 1.182 ms >> >> postgres=# call p(); >> >

Re: INOUT parameters in procedures

2018-03-20 Thread Pavel Stehule
2018-03-20 15:18 GMT+01:00 Merlin Moncure : > On Tue, Mar 20, 2018 at 9:09 AM, Pavel Stehule > wrote: > >> Edit: In one case, after dropping the function and recreating it, I > >> got the procedure to return 0 where it had not before, so this smells > >> like a bug. > >> postgres=# call p(); > >>

Re: INOUT parameters in procedures

2018-03-20 Thread Merlin Moncure
On Tue, Mar 20, 2018 at 9:09 AM, Pavel Stehule wrote: >> Edit: In one case, after dropping the function and recreating it, I >> got the procedure to return 0 where it had not before, so this smells >> like a bug. >> postgres=# call p(); >> 2018-03-20 09:04:50.543 CDT [21494] ERROR: function p() d

Re: INOUT parameters in procedures

2018-03-20 Thread Pavel Stehule
2018-03-20 15:05 GMT+01:00 Merlin Moncure : > On Wed, Feb 28, 2018 at 4:28 PM, Peter Eisentraut > wrote: > > This patch set adds support for INOUT parameters to procedures. > > Currently, INOUT and OUT parameters are not supported. > > > > A top-level CALL returns the output parameters as a resul

Re: INOUT parameters in procedures

2018-03-20 Thread Merlin Moncure
On Wed, Feb 28, 2018 at 4:28 PM, Peter Eisentraut wrote: > This patch set adds support for INOUT parameters to procedures. > Currently, INOUT and OUT parameters are not supported. > > A top-level CALL returns the output parameters as a result row. In > PL/pgSQL, I have added special support to pa

Re: INOUT parameters in procedures

2018-03-20 Thread Rushabh Lathia
On Tue, Mar 20, 2018 at 6:38 AM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 3/19/18 03:25, Rushabh Lathia wrote: > > For the FUNCTION when we have single OUT/INOUT parameter > > the return type for that function will be set to the type of OUT > parameter. > > But in case of P

Re: INOUT parameters in procedures

2018-03-19 Thread Peter Eisentraut
On 3/19/18 03:25, Rushabh Lathia wrote: > For the FUNCTION when we have single OUT/INOUT parameter  > the return type for that function will be set to the type of OUT parameter. > But in case of PROCEDURE, it's always RECORDOID, why this inconsistency? For procedures, this is just an implementatio

Re: INOUT parameters in procedures

2018-03-19 Thread Rushabh Lathia
Thanks Peter for working on this. Sorry for the delay in raising this questions. 1) @@ -302,7 +304,9 @@ interpret_function_parameter_list(ParseState *pstate, /* handle output parameters */ if (fp->mode != FUNC_PARAM_IN && fp->mode != FUNC_PARAM_VARIADIC) { - if

Re: INOUT parameters in procedures

2018-03-15 Thread Tom Lane
Jeff Janes writes: > On Thu, Mar 15, 2018 at 6:58 AM, Tom Lane wrote: >> Not fixed by 8df5a1c868cc28f89ac6221cff8e2b5c952d0eb6? > I think you meant to type "now fixed by". (unless your compiler is pickier > than mine) Actually what I meant was "doesn't that commit fix it for you?"

Re: INOUT parameters in procedures

2018-03-15 Thread Jeff Janes
On Thu, Mar 15, 2018 at 6:58 AM, Tom Lane wrote: > Jeff Janes writes: > > I'm getting compiler warnings: > > pl_exec.c: In function 'exec_stmt_call': > > pl_exec.c:2089:8: warning: variable 'numargs' set but not used > > Not fixed by 8df5a1c868cc28f89ac6221cff8e2b5c952d0eb6? > I think you meant

Re: INOUT parameters in procedures

2018-03-15 Thread Tom Lane
Jeff Janes writes: > I'm getting compiler warnings: > pl_exec.c: In function 'exec_stmt_call': > pl_exec.c:2089:8: warning: variable 'numargs' set but not used Not fixed by 8df5a1c868cc28f89ac6221cff8e2b5c952d0eb6? regards, tom lane

Re: INOUT parameters in procedures

2018-03-14 Thread Jeff Janes
On Wed, Mar 14, 2018 at 10:46 AM, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > committed > > I'm getting compiler warnings: pl_exec.c: In function 'exec_stmt_call': pl_exec.c:2089:8: warning: variable 'numargs' set but not used [-Wunused-but-set-variable] int numargs;

Re: INOUT parameters in procedures

2018-03-14 Thread Peter Eisentraut
committed -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: INOUT parameters in procedures

2018-03-13 Thread Pavel Stehule
2018-03-13 14:14 GMT+01:00 Peter Eisentraut < peter.eisentr...@2ndquadrant.com>: > On 3/8/18 02:25, Pavel Stehule wrote: > > It looks like some error in this concept. The rules for enabling > > overwriting procedures should modified, so this collision should not be > > done. > > > > When I using p

Re: INOUT parameters in procedures

2018-03-13 Thread Peter Eisentraut
On 3/8/18 02:25, Pavel Stehule wrote: > It looks like some error in this concept. The rules for enabling > overwriting procedures should modified, so this collision should not be > done. > > When I using procedure from PL/pgSQL, then it is clear, so I place on > *OUT position variables. But when I

Re: INOUT parameters in procedures

2018-03-07 Thread Pavel Stehule
Hi 2018-03-08 1:53 GMT+01:00 Peter Eisentraut : > On 3/6/18 04:22, Pavel Stehule wrote: > > why just OUT variables are disallowed? > > > > The oracle initializes these values to NULL - we can do same? > > The problem is function call resolution. If we see a call like > > CALL foo(a, b, c); > > t

Re: INOUT parameters in procedures

2018-03-07 Thread Peter Eisentraut
On 3/6/18 04:22, Pavel Stehule wrote: > why just OUT variables are disallowed? > > The oracle initializes these values to NULL - we can do same? The problem is function call resolution. If we see a call like CALL foo(a, b, c); the this could be foo() with zero input and three output parameters

Re: INOUT parameters in procedures

2018-03-06 Thread Pavel Stehule
2018-03-05 19:38 GMT+01:00 Peter Eisentraut < peter.eisentr...@2ndquadrant.com>: > On 3/5/18 11:00, Pavel Stehule wrote: > > I am looking on attached code, and it looks pretty well. Can be really > > nice if this code will be part of release 11, because it is very > > interesting, important featur

Re: INOUT parameters in procedures

2018-03-06 Thread Pavel Stehule
2018-03-05 19:41 GMT+01:00 Pavel Stehule : > > > 2018-03-05 19:38 GMT+01:00 Peter Eisentraut com>: > >> On 3/5/18 11:00, Pavel Stehule wrote: >> > I am looking on attached code, and it looks pretty well. Can be really >> > nice if this code will be part of release 11, because it is very >> > inte

Re: INOUT parameters in procedures

2018-03-05 Thread Pavel Stehule
2018-03-05 19:38 GMT+01:00 Peter Eisentraut < peter.eisentr...@2ndquadrant.com>: > On 3/5/18 11:00, Pavel Stehule wrote: > > I am looking on attached code, and it looks pretty well. Can be really > > nice if this code will be part of release 11, because it is very > > interesting, important featur

Re: INOUT parameters in procedures

2018-03-05 Thread Peter Eisentraut
On 3/5/18 11:00, Pavel Stehule wrote: > I am looking on attached code, and it looks pretty well. Can be really > nice if this code will be part of release 11, because it is very > interesting, important feature feature. Here is an updated patch, rebased on top of several recent changes, also added

Re: INOUT parameters in procedures

2018-03-05 Thread Douglas Doole
> > At the top-level, it's even more dubious. In DB2, apparently you write >> >> CALL foo(123, ?); >> >> with a literal ? for the OUT parameters. >> > That's not actually as scary as it seems. DB2 has two cases where you can use a ? like that: 1) In CLP (DB2's equivalent to psql) DB2 draws a di

Re: INOUT parameters in procedures

2018-03-05 Thread Pavel Stehule
Hi 2018-02-28 23:28 GMT+01:00 Peter Eisentraut < peter.eisentr...@2ndquadrant.com>: > This patch set adds support for INOUT parameters to procedures. > Currently, INOUT and OUT parameters are not supported. > > A top-level CALL returns the output parameters as a result row. In > PL/pgSQL, I have