BETWEEN SYMMETRIC/ASYMMETRIC 
Author Message
 BETWEEN SYMMETRIC/ASYMMETRIC

This is a multi-part message in MIME format.

------=_NextPart_000_0042_01C1E07F.358B8910
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi all,

I've attached a patch for doing BETWEEN SYM/ASYM, however it just doesn't
work!!!

test=# select 2 between 1 and 3;
 ?column?
----------
 t
(1 row)

test=# select 2 between 3 and 1;
 ?column?
----------
 f
(1 row)

test=# select 2 between symmetric 3 and 1;
ERROR:  parser: parse error at or near "3"
test=# select 2 between asymmetric 3 and 1;
ERROR:  parser: parse error at or near "3"
test=# select 2 not between  3 and 1;
 ?column?
----------
 t
(1 row)

test=# select 2 not between symmetric 3 and 1;
ERROR:  parser: parse error at or near "3"

Can anyone see what's wrong?

Chris

------=_NextPart_000_0042_01C1E07F.358B8910
Content-Type: text/plain; name="between.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="between.txt"

Index: src/backend/parser/gram.y
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.301
diff -c -r2.301 gram.y
*** src/backend/parser/gram.y   2002/04/09 20:35:51     2.301
--- src/backend/parser/gram.y   2002/04/10 02:58:38
***************
*** 346,352 ****
                IMMEDIATE, INITIALLY, INOUT,
                OFF, OUT,
                PATH_P, PENDANT,
!               REPLACE, RESTRICT,
          TRIGGER,
                WITHOUT
=20=20
--- 346,352 ----
                IMMEDIATE, INITIALLY, INOUT,
                OFF, OUT,
                PATH_P, PENDANT,
!               REPLACE, RESTRICT, SYMMETRIC, ASYMMETRIC,
          TRIGGER,
                WITHOUT
=20=20
***************
*** 4916,4923 ****
                | a_expr BETWEEN b_expr AND b_expr                      %prec BETWEEN
                                {
                                        $$ =3D makeA_Expr(AND, NULL,
!                                               makeA_Expr(OP, ">=3D", $1, $3),
!                                               makeA_Expr(OP, "<=3D", $1, $5));
                                }
                | a_expr NOT BETWEEN b_expr AND b_expr          %prec BETWEEN
                                {
--- 4916,4942 ----
                | a_expr BETWEEN b_expr AND b_expr                      %prec BETWEEN
                                {
                                        $$ =3D makeA_Expr(AND, NULL,
!                                                       makeA_Expr(OP, ">=3D", $1, $3),
!                                                       makeA_Expr(OP, "<=3D", $1, $5));
!=20
!                               }
!               | a_expr BETWEEN ASYMMETRIC b_expr AND b_expr                   %prec BETWEEN
!                               {
!                                       $$ =3D makeA_Expr(AND, NULL,
!                                                       makeA_Expr(OP, ">=3D", $1, $4),
!                                                       makeA_Expr(OP, "<=3D", $1, $6));
!=20
!                               }
!               | a_expr BETWEEN SYMMETRIC b_expr AND b_expr                    %prec BETWEEN
!                               {
!                                       $$ =3D makeA_Expr(OR, NULL,
!                                               makeA_Expr(AND, NULL,
!                                                       makeA_Expr(OP, ">=3D", $1, $4),
!                                                       makeA_Expr(OP, "<=3D", $1, $6)),
!                                               makeA_Expr(AND, NULL,
!                                                       makeA_Expr(OP, ">=3D", $1, $6),
!                                                       makeA_Expr(OP, "<=3D", $1, $4))
!                                       );
                                }
                | a_expr NOT BETWEEN b_expr AND b_expr          %prec BETWEEN
                                {
***************
*** 4925,4930 ****
--- 4944,4966 ----
                                                makeA_Expr(OP, "<", $1, $4),
                                                makeA_Expr(OP, ">", $1, $6));
                                }
+               | a_expr NOT BETWEEN ASYMMETRIC b_expr AND b_expr               %prec BETWEEN
+                               {
+                                       $$ =3D makeA_Expr(OR, NULL,
+                                               makeA_Expr(OP, "<", $1, $5),
+                                               makeA_Expr(OP, ">", $1, $7));
+                               }
+               | a_expr NOT BETWEEN SYMMETRIC b_expr AND b_expr                %prec BETWEEN
+                               {
+                                       $$ =3D 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
                                {
                                        /* in_expr returns a SubLink or a list of a_exprs */
***************
*** 6093,6099 ****
   * looks too much like a function call for an LR(1) parser.
   */
  col_name_keyword:
!                 BIT                                                   { $$ =3D "bit"; }
                | CHAR                                                  { $$ =3D "char"; }
                | CHARACTER                                             { $$ =3D "character"; }
                | COALESCE                                              { $$ =3D "coalesce"; }
--- 6129,6135 ----
   * looks too much like a function call for an LR(1) parser.
   */
  col_name_keyword:
!                BIT                                                    { $$ =3D "bit"; }
                | CHAR                                                  { $$ =3D "char"; }
                | CHARACTER                                             { $$ =3D "character"; }
                | COALESCE                                              { $$ =3D "coalesce"; }
***************
*** 6127,6133 ****
   *  - thomas 2000-11-28
   */
  func_name_keyword:
!                 AUTHORIZATION                                 { $$ =3D "authorization"; }
                | BETWEEN                                               { $$ =3D "between"; }
                | BINARY                                                { $$ =3D "binary"; }
                | CROSS                                                 { $$ =3D "cross"; }
--- 6163,6169 ----
   *  - thomas 2000-11-28
   */
  func_name_keyword:
!                AUTHORIZATION                                  { $$ =3D "authorization"; }
                | BETWEEN                                               { $$ =3D "between"; }
                | BINARY                                                { $$ =3D "binary"; }
                | CROSS                                                 { $$ =3D "cross"; }
***************
*** 6163,6168 ****
--- 6199,6205 ----
                | AND                                                   { $$ =3D "and"; }
                | ANY                                                   { $$ =3D "any"; }
                | AS                                                    { $$ =3D "as"; }
+               | ASYMMETRIC                                            { $$ =3D "asymmetric"; }
                | ASC                                                   { $$ =3D "asc"; }
                | BOTH                                                  { $$ =3D "both"; }
                | CASE                                                  { $$ =3D "case"; }
***************
*** 6211,6216 ****
--- 6248,6254 ----
                | SELECT                                                { $$ =3D "select"; }
                | SESSION_USER                                  { $$ =3D "session_user"; }
                | SOME                                                  { $$ =3D "some"; }
+               | SYMMETRIC                                             { $$ =3D "symmetric"; }
                | TABLE                                                 { $$ =3D "table"; }
                | THEN                                                  { $$ =3D "then"; }
                | TO                                                    { $$ =3D "to"; }

------=_NextPart_000_0042_01C1E07F.358B8910
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command

------=_NextPart_000_0042_01C1E07F.358B8910--



Sun, 26 Sep 2004 11:04:14 GMT
 BETWEEN SYMMETRIC/ASYMMETRIC

Quote:
> Chris,

> You seem to have forgotten to update keywords.c.

OK - works perfectly now :)

Now I'm going to play with making the SYMMERIC and ASYMMETRIC keywords less
reserved...

Can someone comment on my use of %prec BETWEEN?  Is that still correct now
that we have the extra BETWEEN forms?

Chris

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Sun, 26 Sep 2004 11:38:49 GMT
 BETWEEN SYMMETRIC/ASYMMETRIC

Quote:

> Can someone comment on my use of %prec BETWEEN?  Is that still correct now
> that we have the extra BETWEEN forms?

Looks fine.  AFAICS we want all these forms to have the binding
precedence assigned to BETWEEN.  If you don't do the %prec thing
then the productions will have the precedence of their rightmost
terminal symbol, ie, AND, ie, wrong.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Sun, 26 Sep 2004 12:37:25 GMT
 BETWEEN SYMMETRIC/ASYMMETRIC

Quote:

> > Can someone comment on my use of %prec BETWEEN?  Is that still
> correct now
> > that we have the extra BETWEEN forms?

> Looks fine.  AFAICS we want all these forms to have the binding
> precedence assigned to BETWEEN.  If you don't do the %prec thing
> then the productions will have the precedence of their rightmost
> terminal symbol, ie, AND, ie, wrong.

OK, I've proven that I cannot move the SYM/ASYM keywords anything lower than
totally reserved without causing shift/reduce errors.  Is this acceptable?

Also, Tom (or anyone): in regards to your previous email, should I just go
back to using opt_symmetry to shorten the number of productions, since I
have to make them reserved words anyway?

Chris

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



Sun, 26 Sep 2004 14:09:50 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. BETWEEN SYMMETRIC/ASYMMETRIC

2. BETWEEN SYMMETRIC/ASYMMETRIC

3. patch for BETWEEN [ASYMMETRIC|SYMMETRIC]

4. patch for BETWEEN [ASYMMETRIC|SYMMETRIC]

5. patch for BETWEEN [ASYMMETRIC|SYMMETRIC]

6. patch for BETWEEN [ASYMMETRIC|SYMMETRIC]

7. Asymmetric Sun-cluster

8. Asymmetric Dimension

9. Symmetric Replication (oracle7.3)

10. Help on 7.3 symmetric replication on NT server

11. Symmetric Replication

12. Symmetric replication


 
Powered by phpBB® Forum Software