From: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BETWEEN SYMMETRIC/ASYMMETRIC |
Date: | 2002-04-10 03:58:56 |
Message-ID: | Pine.LNX.4.21.0204101351050.9455-100000@linuxworld.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 10 Apr 2002, Christopher Kings-Lynne wrote:
> > 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?
Yes. Have a look at the precedence table near the top of gram.y:
%left UNION EXCEPT
%left INTERSECT
%left JOIN UNIONJOIN CROSS LEFT FULL RIGHT INNER_P NATURAL
%left OR
%left AND
%right NOT
%right '='
%nonassoc '<' '>'
%nonassoc LIKE ILIKE
%nonassoc ESCAPE
%nonassoc OVERLAPS
%nonassoc BETWEEN
%nonassoc IN
%left POSTFIXOP /* dummy for postfix Op rules */
[...]
This is the order of precedence for rules which contain these
operators. For example, if an expression contains:
a AND b AND c
it is evaluated as:
((a AND b) AND c)
On the other hand:
a OR b AND c
is evaluated as:
((a OR b) AND c)
since OR has a lower order of precedence. Now, consider:
select 2 between asymmetric 3 and 1
Without the %prec BETWEEN
3 and 1
is given precedence over between. This will break your code.
Gavin
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-04-10 04:13:59 | Re: timeout implementation issues |
Previous Message | Bruce Momjian | 2002-04-10 03:50:28 | Re: timeout implementation issues |