I think PG badly needs nested transaction support... ;)
I think that is a main take-away here. You should not try to depend on dblink as a robust replication solution. Perhaps if postgres had two-phase commit and nested transactions, but not at the moment.
That said, depending on how you are implementing the loop in your pseudo-code, you might be able to get closer by using persistent dblink connections, and starting a transaction on the remote side before starting the local transaction and running your plpgsql function (or whatever it is you're running). If the local transaction fails, send an ABORT to the remote side before closing the connection. However I can't offhand think of a way to do that in an automated fashion.
Joe
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly