| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | pgsql-committers(at)postgresql(dot)org |
| Subject: | pgsql: Represent BETWEEN as a special node type in raw parse trees. |
| Date: | 2015-02-22 18:59:35 |
| Message-ID: | E1YPbkd-0002f5-I7@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/34af082f95aa6adb8af5fbd4da46bd4c3c176856
Modified Files
--------------
src/backend/nodes/outfuncs.c | 16 ++++++
src/backend/parser/gram.y | 56 ++++++++-------------
src/backend/parser/parse_expr.c | 102 +++++++++++++++++++++++++++++++++++++++
src/include/nodes/parsenodes.h | 6 ++-
4 files changed, 144 insertions(+), 36 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2015-02-22 19:40:33 | pgsql: Add parse location fields to NullTest and BooleanTest structs. |
| Previous Message | Jeff Davis | 2015-02-22 07:19:13 | pgsql: Rename variable in AllocSetContextCreate to be consistent. |