Search Postgresql Archives

aliases and set of record

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

 



I'd like to use default param so I build up an alias of BasketItems
create or replace function BasketItems(
	_BasketID bigint, _Split boolean, out _ItemID int, out _qty
real )

as...


create or replace function BasketItems(
	_BasketID bigint, out _ItemID int, out _qty real
)
returns setof record as
$$
declare
	_row record;
begin
 for _row in
  select _ItemID as __ItemID, _qty as __qty from
    BasketItems(_BasketID,null)
  loop
      _ItemID:=_row.__ItemID;
      _qty:=_row.__qty;
      return next;
   end loop;
   return;
end;
$$ language plpgsql;

This return 2 empty records _qty and _ItemID are empty
select * from BasketItems(2);

this returns what's expected:
select _ItemID as __ItemID, _qty as __qty from BasketItems(2,null);

What's wrong?

Any way to fix it keeping the names of the returned columns
consistent?

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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[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