On Mon, Jan 14, 2019 at 7:12 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > I think you should stop right there and ask why. Surely that info > can be obtained before starting the operation?
*Thinks some more* Uh, I'm already telling the same _bt_truncate() code path that it is being called from a CREATE INDEX, allowing it to avoid accessing the metapage. I now think that it would be perfectly acceptable to just pass down the insertion scan key for the tuple that caused the split, instead of that build bool, and handle both deadlock issues (index_getprocinfo() hazard and metapage hazard) that way instead. Heikki expressed some concerns about the way the patch accesses the metapage already. I jumped the gun with this catalog index business. Clearly I'd be much better off avoiding *all* new buffer lock protocol stuff by getting both pieces of information up-front -- for some reason I thought that that would be harder than it now appears. Thanks -- Peter Geoghegan