pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Return record on recursive call
3+ messages / 3 participants
[nested] [flat]

* Return record on recursive call
@ 2007-05-28 20:06  Alexander B. <burbello3000@yahoo.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Alexander B. @ 2007-05-28 20:06 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I am creating a function that when finished the last level, should
return for each row.
I put raise notice to trace and the result is correct, but when I try to
execute, an error is showed.

"ERRO: wrong record type supplied in RETURN NEXT"

I created other functions the same way and worked, basically using the
same structure but not recursive.
Is it different return when using recursive.

sample code:
"...
            loop
                raise notice ''  cur1 -> CodCooperativa=% - TipoCoo=%'',
cur1.coo_cod_cooperativa, pTipoCoo;

                cur_result.cod_cooperativa      = cur1.coo_cod_cooperativa;
                cur_result.cooperativa_superior =
cur1.coo_cooperativa_superior;
                cur_result.nro_documento        = cur1.coo_nro_documento;
                cur_result.tipo                 = cur1.reg_cod_registro;
                cur_result.nome_fantasia        = cur1.coo_nome_fantasia;

                return next cur_result;
..."

Thanks in advance.




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Return record on recursive call
@ 2007-05-28 21:40  Michael Fuhr <mike@fuhr.org>
  parent: Alexander B. <burbello3000@yahoo.com.br>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Fuhr @ 2007-05-28 21:40 UTC (permalink / raw)
  To: Alexander B. <burbello3000@yahoo.com.br>; +Cc: pgsql-admin

On Mon, May 28, 2007 at 05:06:55PM -0300, Alexander B. wrote:
> I am creating a function that when finished the last level, should
> return for each row.
> I put raise notice to trace and the result is correct, but when I try to
> execute, an error is showed.
> 
> "ERRO: wrong record type supplied in RETURN NEXT"
> 
> I created other functions the same way and worked, basically using the
> same structure but not recursive.
> Is it different return when using recursive.

It's hard to say what's wrong with your sample code without seeing
it with its surrounding context.  Could you post a complete example?
Please reduce the problem to the smallest possible example that
exhibits the undesirable behavior.

This question is a bit off-topic for pgsql-admin; you might get
more help on pgsql-general.

-- 
Michael Fuhr



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Return record on recursive call
@ 2007-05-29 01:33  Adam Radłowski <adamr@informatyka.gdansk.pl>
  parent: Michael Fuhr <mike@fuhr.org>
  0 siblings, 0 replies; 3+ messages in thread

From: Adam Radłowski @ 2007-05-29 01:33 UTC (permalink / raw)
  To: Michael Fuhr <mike@fuhr.org>; +Cc: Alexander B. <burbello3000@yahoo.com.br>; pgsql-admin

For info only (it's not exactly this same problem):
This function looks like replacement of scroll cursor functionality. 
Cursors are working without problems.

Adamn

Michael Fuhr pisze:
> On Mon, May 28, 2007 at 05:06:55PM -0300, Alexander B. wrote:
>> I am creating a function that when finished the last level, should
>> return for each row.
>> I put raise notice to trace and the result is correct, but when I try to
>> execute, an error is showed.
>>
>> "ERRO: wrong record type supplied in RETURN NEXT"
>>
>> I created other functions the same way and worked, basically using the
>> same structure but not recursive.
>> Is it different return when using recursive.
> 
> It's hard to say what's wrong with your sample code without seeing
> it with its surrounding context.  Could you post a complete example?
> Please reduce the problem to the smallest possible example that
> exhibits the undesirable behavior.
> 
> This question is a bit off-topic for pgsql-admin; you might get
> more help on pgsql-general.
> 



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-05-29 01:33 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-28 20:06 Return record on recursive call Alexander B. <burbello3000@yahoo.com.br>
2007-05-28 21:40 ` Michael Fuhr <mike@fuhr.org>
2007-05-29 01:33   ` Adam Radłowski <adamr@informatyka.gdansk.pl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox