Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion

From: Alban Hertroys <dalroi(at)solfertje(dot)student(dot)utwente(dot)nl>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion
Date: 2010-02-16 12:41:01
Message-ID: F863F1C9-4875-4390-85AC-E904B81CC700@solfertje.student.utwente.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 16 Feb 2010, at 12:35, Peter Geoghegan wrote:
> As I've already said, the problem with this approach is that I see all
> 3 messages at once, when the CONNECTION_EXCEPTION is thrown and we
> finally RETURN, after about 7 seconds (which is undoubtedly how
> RETURNS TABLE is documented to behave). I want (although, as I've
> said, don't expect) to see the first two messages immediately, and
> only the third when the connection fails, so I know what's happening
> in real-time.

It seems you're right, I built a simple test-case (see attachment) using timeofday(). The numbers from fetching from a cursor over the set-returning function run away from the selects that directly call timeofday() in between.
In my case I pause the _client_ between calls, but the results are the same.
Peculiar...

I'm running PostgreSQL 8.4.1 on i386-apple-darwin10.0.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646), 64-bit

!DSPAM:737,4b7a925f10448503891907!

Attachment Content-Type Size
ret_next_test.sql application/octet-stream 459 bytes
unknown_filename text/plain 150 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2010-02-16 12:47:58 Re: Week numbers and calculating weekly statistics/diagrams
Previous Message Alexander Farber 2010-02-16 12:14:26 Week numbers and calculating weekly statistics/diagrams