Syntax conflicts in frame clause

Lists: pgsql-hackers
From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Syntax conflicts in frame clause
Date: 2009-11-24 17:08:41
Message-ID: e08cc0400911240908s7efaea85wc8505d228220b980@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Rewriting my frame support types patch to allow any expression in
PRECEDING/FOLLOWING clause, I found the syntax below in PG conflicts:

frame_extent: frame_bound { ... }
| BETWEEN frame_bound AND frame_bound { ... }
;
frame_bound: UNBOUNDED PRECEDING { ... }
| UNBOUNDED FOLLOWING { ... }
| CURRENT_P ROW { ... }
| a_expr PRECEDING { ... }
| a_expr FOLLOWING { .... }
;

because a_expr (and of course b_expr) contains BETWEEN as
type_func_name_keyword, which means the starting BETWEEN in
frame_extend is completely ambiguous. When I tried to move BETWEEN to
reserved_keyword, it was solved as expected.

In my poor mind there's no way to avoid this situation as long as you
keep BETWEEN as type_func_name_keyword, but could anyone have a
solution for this?

Regards,

--
Hitoshi Harada


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Syntax conflicts in frame clause
Date: 2009-11-24 18:02:31
Message-ID: 20210.1259085751@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> Rewriting my frame support types patch to allow any expression in
> PRECEDING/FOLLOWING clause, I found the syntax below in PG conflicts:

Yeah, we ran into that in the original WINDOW patch IIRC, and found some
solution to it that got taken out again when the functionality was cut
down for 8.4. You might want to look back to see what that looked like;
I think we avoided reserving BETWEEN at the cost of making the
productions a bit more redundant.

regards, tom lane


From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Syntax conflicts in frame clause
Date: 2009-11-25 01:03:11
Message-ID: e08cc0400911241703u4bf53ek1c3910605a3d8778@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2009/11/25 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
>> Rewriting my frame support types patch to allow any expression in
>> PRECEDING/FOLLOWING clause, I found the syntax below in PG conflicts:
>
> Yeah, we ran into that in the original WINDOW patch IIRC, and found some
> solution to it that got taken out again when the functionality was cut
> down for 8.4.  You might want to look back to see what that looked like;
> I think we avoided reserving BETWEEN at the cost of making the
> productions a bit more redundant.

Oops, I've forgot that :(

http://archives.postgresql.org/message-id/6363.1229890896@sss.pgh.pa.us

At the time you put BETWEEN as reserved_keyword, but my trial showed
col_name_keyword can also be a candidate.

Regards,

--
Hitoshi Harada