Tom Lane wrote:
>
> I think that the easiest fix might be to not remove no-longer-used
> segment files during a truncate, but simply reduce them to zero size
> rather than delete them. Then any open file pointers aren't
> invalidated. The only alternative I can see is to invent some new
> signaling mechanism to force closure of open files, but that seems
> ugly, complex, and perhaps subject to race conditions.
>
Setting the files to zero size seems to make sense all around, as when
the bgwriter wants to use one of those segments it can 'figure out' that
there's nothing in the file and it should start at offset zero.
Regards,
Paul Bort