aboutsummaryrefslogtreecommitdiff
path: root/src/backend/regex/regcomp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/regex/regcomp.c')
-rw-r--r--src/backend/regex/regcomp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/regex/regcomp.c b/src/backend/regex/regcomp.c
index 4f9da5b0468..6b80140e909 100644
--- a/src/backend/regex/regcomp.c
+++ b/src/backend/regex/regcomp.c
@@ -1088,8 +1088,12 @@ parseqatom(struct vars * v,
NOERR();
}
- /* it's quantifier time; first, turn x{0,...} into x{1,...}|empty */
- if (m == 0)
+ /*
+ * It's quantifier time. If the atom is just a BACKREF, we'll let it deal
+ * with quantifiers internally. Otherwise, the first step is to turn
+ * x{0,...} into x{1,...}|empty
+ */
+ if (m == 0 && atomtype != BACKREF)
{
EMPTYARC(s2, atom->end); /* the bypass */
assert(PREF(qprefer) != 0);