Skip site navigation (1) Skip section navigation (2)

Re: pl-pgsql, recursion and cursor contexting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: pl-pgsql, recursion and cursor contexting
Date: 2008-09-29 14:27:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
"Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com> writes:
> I'm in the business of writting recursive PL-Pgsql functions.  I need to
> know what happens to the data stream from a select cursor inside of
> which the recursive call is made.  For example....

Nothing, unless you use explicitly-named cursors and force a cursor name
conflict.  A for-loop's internal cursor always gets a name chosen to be
distinct from every other existing cursor, so there's no conflict.

> This comes up witht he right answer.  IOW, making the recursive call
> from within the "for rec in..." loop doesn't seem to destroy the data
> streams from earlier calls.  I just need to make sure that this will
> always be the case and that getting the correct result in this example
> is not just an artifact of it's simplicity.  I know, for example, this
> was a no-no in Oracle.

Wow, are they really that broken?

			regards, tom lane

In response to


pgsql-general by date

Next:From: Pavel StehuleDate: 2008-09-29 14:27:35
Subject: Re: pl-pgsql, recursion and cursor contexting
Previous:From: john.crawfordDate: 2008-09-29 14:21:05
Subject: database question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group