Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > I think we can live with requiring a variable name to start with an
> > alphabetic or underscore.
>
> > SELECT a[1:2]
>
> > is clear and
>
> > SELECT a[1:myvar]
>
> > expands to SELECT a[1].
>
> No go --- SELECT a[1:b] where b is a field name is a valid query
> currently.
The colon in array syntax is quite a special case. It should be relatively
easy to figure out whether you are in a construct of the form
[<token>:<token>]. And then there should be no problem in figuring out that
in
[1:b] b refers to a column and in [1::b] ':b' is a variable. Do colons
apear anywhere else?
Btw, i agree that variables should start with a letter and by default
variables have to be declared.
Adriaan