diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-02-22 13:57:56 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-02-22 13:57:56 -0500 |
commit | 34af082f95aa6adb8af5fbd4da46bd4c3c176856 (patch) | |
tree | 7a88551954fa65e5a5e695655ce67feac61a44be /src/include/nodes/parsenodes.h | |
parent | 74811c4050921959d54d42e2c15bb79f0e2c37f3 (diff) |
Represent BETWEEN as a special node type in raw parse trees.
Previously, gram.y itself converted BETWEEN into AND (or AND/OR) nests of
expression comparisons. This was always as bogus as could be, but fixing
it hasn't risen to the top of the to-do list. The present patch invents an
A_Expr representation for BETWEEN expressions, and does the expansion to
comparison trees in parse_expr.c which is at least a slightly saner place
to be doing semantic conversions. There should be no change in the post-
parse-analysis results.
This does nothing for the semantic issues with BETWEEN (dubious connection
to btree-opclass semantics, and multiple evaluation of possibly volatile
subexpressions) ... but it's a necessary preliminary step before we could
fix any of that. The main immediate benefit is that preserving BETWEEN as
an identifiable raw-parse-tree construct will enable better error messages.
While at it, fix the code so that multiply-referenced subexpressions are
physically duplicated before being passed through transformExpr(). This
gets rid of one of the principal reasons why transformExpr() has
historically had to allow already-processed input.
Diffstat (limited to 'src/include/nodes/parsenodes.h')
-rw-r--r-- | src/include/nodes/parsenodes.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index b1dfa85eb0d..35b68ec0332 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -232,7 +232,11 @@ typedef enum A_Expr_Kind AEXPR_DISTINCT, /* IS DISTINCT FROM - name must be "=" */ AEXPR_NULLIF, /* NULLIF - name must be "=" */ AEXPR_OF, /* IS [NOT] OF - name must be "=" or "<>" */ - AEXPR_IN /* [NOT] IN - name must be "=" or "<>" */ + AEXPR_IN, /* [NOT] IN - name must be "=" or "<>" */ + AEXPR_BETWEEN, /* name must be "BETWEEN" */ + AEXPR_NOT_BETWEEN, /* name must be "NOT BETWEEN" */ + AEXPR_BETWEEN_SYM, /* name must be "BETWEEN SYMMETRIC" */ + AEXPR_NOT_BETWEEN_SYM /* name must be "NOT BETWEEN SYMMETRIC" */ } A_Expr_Kind; typedef struct A_Expr |