diff options
| author | Tom Lane | 2014-06-16 19:55:05 +0000 |
|---|---|---|
| committer | Tom Lane | 2014-06-16 19:55:30 +0000 |
| commit | 2146f13408cdb85c738364fe8f7965209e08c6be (patch) | |
| tree | 9c5989a33d072788a51411dd7ee1bedb14f2280d /src/test | |
| parent | ac608fe758455804f26179ea7c556e7752e453e8 (diff) | |
Avoid recursion when processing simple lists of AND'ed or OR'ed clauses.
Since most of the system thinks AND and OR are N-argument expressions
anyway, let's have the grammar generate a representation of that form when
dealing with input like "x AND y AND z AND ...", rather than generating
a deeply-nested binary tree that just has to be flattened later by the
planner. This avoids stack overflow in parse analysis when dealing with
queries having more than a few thousand such clauses; and in any case it
removes some rather unsightly inconsistencies, since some parts of parse
analysis were generating N-argument ANDs/ORs already.
It's still possible to get a stack overflow with weirdly parenthesized
input, such as "x AND (y AND (z AND ( ... )))", but such cases are not
mainstream usage. The maximum depth of parenthesization is already
limited by Bison's stack in such cases, anyway, so that the limit is
probably fairly platform-independent.
Patch originally by Gurjeet Singh, heavily revised by me
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/rules.out | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 87870cf1af6..ca56b47618b 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -2117,7 +2117,7 @@ shoe_ready| SELECT rsh.shoename, int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM shoe rsh, shoelace rsl - WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm)); + WHERE ((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm)); shoelace| SELECT s.sl_name, s.sl_avail, s.sl_color, |
