Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion
Date
Msg-id db471ace1002160134r39b00b96jd9d4d89df6097a5e@mail.gmail.com
Whole thread Raw
In response to Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Responses Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general
> I'd think RETURN NEXT would behave the way you want it to. There's probably something in your function causing your
functionto behave like it does now. I suspect the problem lies in the way you determine how far you've progressed, but
youdidn't tell us anything about your function, so I'm just guessing. 
>

Why do you think that? At the moment, the function merely sends two
messages along the lines of "beginning downloading...",  "connecting
to first db...", before connecting to the first remote DB, which, in
my perfunctory testing was unavailable. The connection blocks, throws
an exception, is handled in an EXECPTION block (by once again sending
a message in the usual way). However, I get all 3 messages at once,
only when the dblink function finishes blocking and throws its
exception, which takes about 7 seconds because I like to use a timeout
in my connection string.

> I don't know much about dblink, so it is possible your problem is related to that. I imagine it may batch "small"
resultsets and send them over all at once to reduce traffic. Do you see this problem with larger result sets (say >10k
rows)?
>

I'll attempt to devise a useful test, but I'm a little doubtful that
I'll get anywhere with my current approach, given that my initial,
very simple test failed.

Regards,
Peter Geoghegan

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion
Next
From: Alban Hertroys
Date:
Subject: Re: Having a plpgsql function return multiple rows that indicate its progress in a cursor like fashion