Tomas Vondra <tomas.von...@2ndquadrant.com> writes: > This should do the trick - I've failed to realize exec_stmt_call may > exit by calling elog(ERROR) too, in which case the plan pointer was not > reset.
> This does fix the failures presented here, but I don't think it's the > right solution No, it's completely unacceptable. If there's really no other way, you could use a PG_TRY block to ensure that the pointer gets reset on the way out. But I question why we've got a design that requires that in the first place. It's likely to have more problems than this. regards, tom lane