Re: Allowing same cursor name in nested levels

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Allowing same cursor name in nested levels
Date: 2011-08-16 13:55:52
Message-ID: 25892.1313502952@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeevan Chalke <jeevan(dot)chalke(at)enterprisedb(dot)com> writes:
> 1. I have two functions func1 and func2.
> 2. func1 calls func2
> 3. Both has cursor with same name, say mycursor
> 4. Somehow I forgot closing it
> 5. executing func1 throws an error 'cursor "mycursor" already in use'

> Is this expected behavior???

Yes ... or at least, it's always been like that.

> I just mingled around the code and later appended a cursor count to the
> cursor name to allow same cursor name in nested levels.

That would break code that expects the cursor name to be what it said
it should be. It is documented that you can refer to cursors by name
across multiple functions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-08-16 13:59:04 Re: synchronized snapshots
Previous Message Robert Haas 2011-08-16 13:43:06 Re: Re: Should we have an optional limit on the recursion depth of recursive CTEs?