agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: ALMA TAHIR <almaheena2003@yahoo.co.in>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Function Issue
Date: Fri, 28 Feb 2014 21:13:10 +0800 (SGT)
Message-ID: <1393593190.2407.YahooMailNeo@web192706.mail.sg3.yahoo.com> (raw)
In-Reply-To: <30402.1393511579@sss.pgh.pa.us>
References: <1393503792.47079.YahooMailNeo@web192706.mail.sg3.yahoo.com>
	<30402.1393511579@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

hi,
thankyou for suggestions, its working now. I ma retrieving the ids in an int[] and then using one more cursor to read and return using the int[]. 





On Thursday, 27 February 2014 8:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
ALMA TAHIR <almaheena2003@yahoo.co.in> writes:
> I want to open a ref cursor with select for update and then update
> the records and get the ref cursor in response back in java.

Your function has already sucked all the rows out of the cursor before
it returns it, so it's not surprising that further reads from the cursor
produce nothing.

You could try rewinding the cursor (see MOVE) but I'm not sure that will
help in this case, since the function has carefully ensured that none of
the rows pass the cursor query's WHERE condition anymore.  I think that
since the cursor used SELECT FOR UPDATE, it will not return the updated
rows even after rewinding.  (I could be wrong though, so it's worth

trying.)

I think you need to rethink what you're doing.  This seems like a fairly
silly application design: why not do all the processing you need on these
rows in one place?  Or at the very least, don't use one cursor to serve
two masters.  Possibly you could have the function return the rows itself
instead of passing back a refcursor.

            regards, tom lane


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql

view thread (7+ messages)  latest in thread

Message-ID: <1393593190.2407.YahooMailNeo@web192706.mail.sg3.yahoo.com>
Permalink:  ../1393593190.2407.YahooMailNeo@web192706.mail.sg3.yahoo.com/
Also on:    postgresql.org/message-id/1393593190.2407.YahooMailNeo@web192706.mail.sg3.yahoo.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: almaheena2003@yahoo.co.in, tgl@sss.pgh.pa.us
  Subject: Re: Function Issue
  In-Reply-To: <1393593190.2407.YahooMailNeo@web192706.mail.sg3.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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