On Sun, Jul 9, 2023 at 7:18 AM Tom Lane <t...@sss.pgh.pa.us> wrote: > > Michael Paquier <mich...@paquier.xyz> writes: > > That should be OK, I assume. However, if this is improved and > > something we want to support in the long-run I guess that a TAP test > > may be appropriate. > > I do not see the point of a TAP test. It's not like the code isn't > covered perfectly well.
Please find attached the patch that makes REINDEX TABLE perform reindex on toast table before reindexing the main table's indexes. The code block movement involved slightly more thought and care than I had previously imagined. As explained in comments in the patch, the enumeration and suppression of indexes on the main table must happen before any CommandCounterIncrement() call, hence the reindex-the-toast-table-if-any code had to be placed after that enumeration. In support of the argument above, the patch does not include any TAP tests. Reliably reproducing the original error message involves restarting the database, and since that can't be done via SQL commands, no sql tests are included, either. The patch also includes minor wordsmithing, and benign whitespace changes in neighboring code. Best regards, Gurjeet http://Gurje.et
v1-0001-Reindex-toast-table-s-index-before-main-table-s-i.patch
Description: Binary data