--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -175,6 +175,30 @@
 }
 
 /*
+ * Return true if a key column of 'idxrel' is NULL in 'searchslot' and the
+ * index access method cannot search for NULLs.  An index scan with such a
+ * scan key returns nothing (hash indexes do not store NULLs).
+ */
+static bool
+replindex_key_unsearchable(Relation idxrel, TupleTableSlot *searchslot)
+{
+       int2vector *indkey = &idxrel->rd_index->indkey;
+
+       if (idxrel->rd_indam->amsearchnulls)
+               return false;
+
+       for (int i = 0; i < IndexRelationGetNumberOfKeyAttributes(idxrel);
