diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index 5c5a9a8cd2d91f9e57fff47fc21433a26145a949..9b3fe64807e508a5975b03cce2b243adf972ccdb 100644
*** a/src/backend/regex/regcomp.c
--- b/src/backend/regex/regcomp.c
*************** parsebranch(struct vars * v,
*** 712,717 ****
--- 712,718 ----
  
  		/* NB, recursion in parseqatom() may swallow rest of branch */
  		parseqatom(v, stopper, type, lp, right, t);
+ 		NOERRN();
  	}
  
  	if (!seencontent)
*************** parseqatom(struct vars * v,
*** 1169,1174 ****
--- 1170,1176 ----
  		EMPTYARC(s2, rp);
  		t->right = subre(v, '=', 0, s2, rp);
  	}
+ 	NOERR();
  	assert(SEE('|') || SEE(stopper) || SEE(EOS));
  	t->flags |= COMBINE(t->flags, t->right->flags);
  	top->flags |= COMBINE(top->flags, t->flags);
