Re: SELECT DISTINCT ON bug? - Mailing list pgsql-general

From scott.marlowe
Subject Re: SELECT DISTINCT ON bug?
Date
Msg-id Pine.LNX.4.33.0305221154570.23585-100000@css120.ihs.com
Whole thread Raw
In response to Re: SELECT DISTINCT ON bug?  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: SELECT DISTINCT ON bug?
List pgsql-general
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.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Having problems with anoncvs
Next
From: Mike Mascari
Date:
Subject: Re: PRIMARY KEYS