> I'd think RETURN NEXT would behave the way you want it to. There's probably something in your function causing your function to behave like it does now. I suspect the problem lies in the way you determine how far you've progressed, but you didn'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" result sets 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 -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general