Change inv_truncate() to not repeat its systable_getnext_ordered() scan.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 7ab6f2da23516e48174f3f144ee9ef19bdc287fb
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2011-01-27T00:33:50Z
Releases: 9.1.0
Change inv_truncate() to not repeat its systable_getnext_ordered() scan.

In the case where the initial call of systable_getnext_ordered() returned
NULL, this function would nonetheless call it again.  That's undefined
behavior that only by chance failed to not give visibly incorrect results.
Put an if-test around the final loop to prevent that, and in passing
improve some comments.  No back-patch since there's no actual failure.

Per report from YAMAMOTO Takashi.

Files

PathChange+/−
src/backend/storage/large_object/inv_api.c modified +16 −5