You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
A bug in the original free space computation made it possible toreturn a page which wasn't actually able to fit the item. Since theinsertion code isn't prepared to deal with PageAddItem failing, a PANICresulted ("failed to add BRIN tuple [to new page]"). Add a macro toencapsulate the correct computation, and use it inbrin_getinsertbuffer's callers before calling that routine, to raise anearly error.I became aware of the possiblity of a problem in this area while workingonccc4c07. There's no archived discussion about it, but it'seasy to reproduce a problem in the unpatched code with something likeCREATE TABLE t (a text);CREATE INDEX ti ON t USING brin (a) WITH (pages_per_range=1);for length in `seq 8000 8196`dopsql -f - <<EOFTRUNCATE TABLE t;INSERT INTO t VALUES ('z'), (repeat('a', $length));EOFdoneBackpatch to 9.5, where BRIN was introduced.