Re: [SQL] Cursors..

2008-08-19 Thread Yura Gal
Take a look at http://www.postgresql.org/docs/8.3/interactive/plpgsql-cursors.html and you'll find answer you need. > I need to convert this cursor of Oracle to Postgres... > I wait for your help!! -- Best regards, Yuri. -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make ch

Re: [SQL] cursors and sessions

2008-03-13 Thread Aaron Bono
On Thu, Mar 13, 2008 at 5:54 PM, chester c young <[EMAIL PROTECTED]> wrote: > is there any way to share a cursor between sessions? > > I have a costly query whose records need to be visited by in order by n > number of concurrent sessions, and am unable to find the best way of > doing this. > > I'

Re: [SQL] Cursors and recursion

2005-12-28 Thread Michael Fuhr
On Wed, Dec 28, 2005 at 04:37:21PM -0300, Don Croata wrote: > Please, if someone recalls a link, book, piece of code or anything with info > about this technique for PL/PgSQL (8.1), please let us know. We've been > searching into google, groups.google, http://archives.postgresql.org and > http://ww

Re: [SQL] Cursors and recursion

2005-12-28 Thread Don Croata
Please, if someone recalls a link, book, piece of code or anything with info about this technique for PL/PgSQL (8.1), please let us know. We've been searching into google, groups.google, http://archives.postgresql.org and http://www.postgresql.org/docs/8.1/interactive with no results. Most of the

Re: [SQL] Cursors and recursion

2005-12-28 Thread Michael Fuhr
On Wed, Dec 28, 2005 at 10:48:25AM -0500, Tom Lane wrote: > Don Croata <[EMAIL PROTECTED]> writes: > > It's a function who has a cursor and calls itself, but the problem raises > > after the first recursion, when PgSQL complains: > > > ERROR: cursor "cur" already in use > > > Are the cursors kep

Re: [SQL] Cursors and recursion

2005-12-28 Thread Tom Lane
Don Croata <[EMAIL PROTECTED]> writes: > It's a function who has a cursor and calls itself, but the problem raises > after the first recursion, when PgSQL complains: > ERROR: cursor "cur" already in use > Are the cursors kept globally? or cached like TEMP TABLE? Cursor names are global within a

Re: [SQL] cursors and for loops?

2004-04-15 Thread Jan Wieck
Just FYI, recent versions of PG use cursors internally for PL/pgSQL FOR loops. So there is no danger for a procedure to run out of memory when looping over a huge result set ... at least not because of that. Jan Dennis wrote: Tom Lane writes: Something like LOOP FET

Re: [SQL] cursors and for loops?

2004-04-13 Thread Richard Huxton
On Sunday 11 April 2004 19:46, Dennis wrote: > Tom Lane writes: > > Something like > > > > LOOP > > FETCH ...; > > EXIT WHEN NOT found; > > ... > > END LOOP; > > Thank you! I tried finding documentation on "found" in this context and > didn't come up with

Re: [SQL] cursors and for loops?

2004-04-11 Thread Dennis
Tom Lane writes: Something like LOOP FETCH ...; EXIT WHEN NOT found; ... END LOOP; Thank you! I tried finding documentation on "found" in this context and didn't come up with anything. Can you point me to where it is documented?

Re: [SQL] cursors and for loops?

2004-04-11 Thread Tom Lane
"Dennis" <[EMAIL PROTECTED]> writes: > I am wondering if I can use a cursor in a for loop. Something like LOOP FETCH ...; EXIT WHEN NOT found; ... END LOOP; should do it. regards, tom lane -

Re: [SQL] cursors in plpgsql

2003-09-17 Thread Tomasz Myrta
Releases before 7.4 are spotty about supporting backwards scan of complex queries --- if you have a join or aggregate in the query, it likely won't work, yielding either strange errors or wrong answers. It will work if the top plan node in the query is a SORT, though, so a possible workaround is to

Re: [SQL] cursors in plpgsql

2003-09-17 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: > I wanted to use some select result several times in pl/pgsql function. > Neither move backward 1 in test; > nor > execute ''move backward 1 in test''; > doesn't work. Releases before 7.4 are spotty about supporting backwards scan of complex queri

Re: [SQL] Cursors and backwards scans and SCROLL

2003-03-09 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: > Enforcing spec seems like the least confusing mode to operate under, > especially given it could break simply by changing the plan -- which > happens automagically (seemingly random). Keep in mind though that complaints about the current bugs have been fair

Re: [SQL] Cursors and backwards scans and SCROLL

2003-03-09 Thread Rod Taylor
> I'm presently leaning to #2, even though it exposes implementation > details. I'm open to discussion though. Any preferences? Other ideas? How about a variable that turns on or off spec enforcement (case #1 or #2). On for 7.4, off for 7.5 the next release, and make it disappear after that. E

Re: [SQL] Cursors and backwards scans and SCROLL

2003-03-09 Thread Josh Berkus
Tom, > Postgres' implementation of cursors has always had a problem with doing > MOVE or FETCH backwards on complex queries. Coincidnetally enough, I was just chatting with one of my contractors yesterday about how the one thing that Transact-SQL has to offer is a really good cursor implementa

Re: [SQL] Cursors in plpgsql

2001-04-17 Thread Josh Berkus
Preeti, > Is there a command in plpgsql similar to %NOTFOUND of oracle? Cursors are not currently supported for PL/pgSQL. There are plans to include them for and upcoming version of Postgres. But dont' wait your application on it. > i want to write a load script which takes each row from the