From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: patch for BETWEEN [ASYMMETRIC|SYMMETRIC] |
Date: | 2001-05-07 18:47:26 |
Message-ID: | 200105071847.f47IlQH20283@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Can someone comment on where we left this?
> This was a trivial thing to implement in the parser (unless I overlooked
> something!). Please review it and let me know if I missed something. This
> adds SQL-1999 BETWEEN [ASYMMETRIC|SYMMETRIC] language. Hopefully it's not
> considered just SQL bloat. ;)
---------------------------------------------------------------------------
*** gram.y Wed Jan 10 20:45:40 2001
--- gram.y.modi Wed Jan 10 20:44:38 2001
***************
*** 321,332 ****
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE
/* Keywords (in SQL3 reserved words) */
! %token CHAIN, CHARACTERISTICS,
DEFERRABLE, DEFERRED,
IMMEDIATE, INITIALLY, INOUT,
OFF, OUT,
PATH_P, PENDANT,
RESTRICT,
TRIGGER,
WITHOUT
--- 321,334 ----
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE
/* Keywords (in SQL3 reserved words) */
! %token ASYMMETRIC,
! CHAIN, CHARACTERISTICS,
DEFERRABLE, DEFERRED,
IMMEDIATE, INITIALLY, INOUT,
OFF, OUT,
PATH_P, PENDANT,
RESTRICT,
+ SYMMETRIC,
TRIGGER,
WITHOUT
***************
*** 4452,4462 ****
--- 4454,4496 ----
makeA_Expr(OP, ">=", $1, $3),
makeA_Expr(OP, "<=", $1, $5));
}
+ | a_expr BETWEEN ASYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $4),
+ makeA_Expr(OP, "<=", $1, $6));
+ }
+ | a_expr BETWEEN SYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(OR, NULL,
+ makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $4),
+ makeA_Expr(OP, "<=", $1, $6)),
+ makeA_Expr(AND, NULL,
+ makeA_Expr(OP, ">=", $1, $6),
+ makeA_Expr(OP, "<=", $1, $4)) );
+ }
| a_expr NOT BETWEEN b_expr AND b_expr
{
$$ = makeA_Expr(OR, NULL,
makeA_Expr(OP, "<", $1, $4),
makeA_Expr(OP, ">", $1, $6));
+ }
+ | a_expr NOT BETWEEN ASYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $5),
+ makeA_Expr(OP, ">", $1, $7));
+ }
+ | a_expr NOT BETWEEN SYMMETRIC b_expr AND b_expr
+ {
+ $$ = makeA_Expr(AND, NULL,
+ makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $5),
+ makeA_Expr(OP, ">", $1, $7)),
+ makeA_Expr(OR, NULL,
+ makeA_Expr(OP, "<", $1, $7),
+ makeA_Expr(OP, ">", $1, $5)) );
}
| a_expr IN '(' in_expr ')'
{
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Ashley Clark | 2001-05-07 19:56:31 | Re: [GENERAL] Strange notices, should I worry? |
Previous Message | Bruce Momjian | 2001-05-07 17:19:49 | Re: [GENERAL] Strange notices, should I worry? |