Re: Allowing same cursor name in nested levels - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allowing same cursor name in nested levels
Date
Msg-id 25892.1313502952@sss.pgh.pa.us
Whole thread Raw
In response to Allowing same cursor name in nested levels  (Jeevan Chalke <jeevan.chalke@enterprisedb.com>)
Responses Re: Allowing same cursor name in nested levels
List pgsql-hackers
Jeevan Chalke <jeevan.chalke@enterprisedb.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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Re: Should we have an optional limit on the recursion depth of recursive CTEs?
Next
From: Robert Haas
Date:
Subject: Re: synchronized snapshots