aliases and set of record - Mailing list pgsql-general

From Ivan Sergio Borgonovo
Subject aliases and set of record
Date
Msg-id 20080320134139.15d45f21@webthatworks.it
Whole thread Raw
Responses Re: [solved] aliases and set of record  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Karsten Hilbert
Date:
Subject: Re: Problem with async notifications of table updates
Next
From: Ivan Sergio Borgonovo
Date:
Subject: Re: [solved] aliases and set of record