On Wed, 21 May 2003, Bruno Wolff III wrote:
> On Wed, May 21, 2003 at 10:58:26 +0100,
> "Nigel J. Andrews" <nandrews@investsystems.co.uk> wrote:
> >
> > Syntax:
> > SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
> > * | expression [ AS output_name ] [, ...]
>
> This syntax expression does seem wrong. Usually concatenation takes
> precedence over alternation. I think there really should be {}s around
> the second line.
Good point. As written, syntax says you can either select * OR you can
select field1,field2,field3, but you can't select *,oid ...
Since we allow select *,field,function,expression, it would seem we need
the {}s there around * | expression [ AS output_name ] [, ...]
part.
Reference for those who like reading the SQL spec:
3.2 Notation
[ ] Square brackets indicate optional elements in a formula.
The portion of the formula within the brackets may be
explicitly specified or may be omitted.
{ } Braces group elements in a formula. The portion of the for-
mula within the braces shall be explicitly specified.
| The alternative operator. The vertical bar indicates that
the portion of the formula following the bar is an alterna-
tive to the portion preceding the bar. If the vertical bar
appears at a position where it is not enclosed in braces
or square brackets, it specifies a complete alternative for
the element defined by the production rule. If the vertical
bar appears in a portion of a formula enclosed in braces or
square brackets, it specifies alternatives for the contents
of the innermost pair of such braces or brackets.