Also attach the patches for back branch and remove some unnecessary
changes from pgindent.
I reviewed your patch and I think the fix could be simplified by
if (OidIsValid(indexOid))
CacheInvalidateRelcache(rel);
If indexOid is valid it is a REPLICA IDENTITY INDEX. A few lines above there is
a check for a valid indexOid that makes sure the index is already marked as a
replica identity; if so, it bail out. If it is not, the relation should be
invalidated. Am I missing something?
I also modified your test case to include a DELETE command, wait the initial
table sync to avoid failing a subsequent test and improve some comments.