Search Postgresql Archives

Solution: implicit vs. explicit RETURN when OUT is used

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 4 Jan 2008 09:38:35 +0100
Ivan Sergio Borgonovo <mail@xxxxxxxxxxxxxxx> wrote:

> create or replace function testA(out _BasketID1 int, out _BasketID2
> int) as $$
> begin
> 	_BasketID1:=1;
> 	_BasketID2:=2;
> 	return;
> end;
> $$ language plpgsql;
> 
> create or replace function testB(out _BasketID1 int, out _BasketID2
> int) as
> $$
> begin
> 	select into _BasketID1,_BasketID2  * from testA();
> 	return;
> end;
> $$ language plpgsql;
> 

> But when I switch to
> 
> select into _BasketID1,_BasketID2 _BasketID1,_BasketID2 from
> testA();
> 
> nothing get back from testB().

OK switching to:

select _BasketID1,_BasketID2 into _BasketID1,_BasketID2 from testA();
still didn't return anything but 
changing the def to

create or replace function testB(out _BasketID1 int, out _BasketID2
int) as
$$
begin
  select a._BasketID1,a._BasketID2 into _BasketID1z,_BasketID2z from
testA() as a;
  return;
end;
$$ language plpgsql;

did work.

here you get the same in a maybe more readable, cut&pastable format:

http://www.webthatworks.it/d1/node/page/returning_composite_type_postgresql_functions_without_declaring_explicitly_composite_type

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux