Gregory Stark <stark@xxxxxxxxxxxxxxxx> writes: > "Pit M." <fmi-soft@xxxxxx> writes: >> The goal is to maintain a valid cursor that can be used to FETCH other records. >> It would be ideal to skip this record an continue fetching the next record -> >> but how can i achieve this? > Well ideally the answer would be to wrap each FETCH in a savepoint and roll > back to the savepoint if it fails. However I just tried it and this doesn't > work. So I think the answer is you can't, sorry. The problem is to distinguish failures that don't imply the cursor itself is broken from failures that do. What I'd suggest is reducing the cursor definition to a simple "SELECT * FROM ..." and then doing the failure-prone calculations separately. The cursor won't get marked PORTAL_FAILED unless the error occurs during a FETCH from it. regards, tom lane