Jeff Janes wrote:
> At line 252 of brin_xlog.c, should the UnlockReleaseBuffer(metabuf) be
> protected by a BufferIsValid?
Yes, that was just me being careless. Fixed.
> Now I am getting segfaults during normal (i.e. no intentional crashes)
> operations. I think I was seeing them sometimes before as well, I just
> wasn't looking for them.
Interesting. I was neglecting to test for empty index tuples in the
Consistent support function. Should be fixed now, and I verified that
the other support functions check for this condition (AFAICS this was
the only straggler -- I had fixed all the others already).
> I think this is related to having block ranges which have no tuples in them
> when they are first summarized. If I take out the "with t as (delete from
> foo returning *) insert into foo select * from t", then I don't see the
> crashes
Exactly.
After fixing that I noticed that there was an assertion (about
collations) failing under certain conditions with your script. I also
fixed that. I also added a test for regress. I didn't have time to
distill a standalone test case for your crash, though.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services