Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDcrH-0005ob-PX for pgsql-docs@arkaria.postgresql.org; Tue, 20 Jan 2015 17:44:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YDcrG-0002OX-VK for pgsql-docs@arkaria.postgresql.org; Tue, 20 Jan 2015 17:44:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YDcrG-0002OJ-Bm for pgsql-docs@postgresql.org; Tue, 20 Jan 2015 17:44:54 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDcrC-0006Fd-PR for pgsql-docs@postgresql.org; Tue, 20 Jan 2015 17:44:52 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id D5CFF112364B for ; Tue, 20 Jan 2015 09:44:50 -0800 (PST) Date: Tue, 20 Jan 2015 10:44:50 -0700 (MST) From: David G Johnston To: pgsql-docs@postgresql.org Message-ID: <1421775890421-5834768.post@n5.nabble.com> In-Reply-To: <10373.1421765321@sss.pgh.pa.us> References: <10373.1421765321@sss.pgh.pa.us> Subject: Re: Aggregate expression syntax MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org Tom Lane-2 wrote > Thom Brown < > thom@ > > writes: >> Looking at the syntax for aggregate expressions in the docs, it seems the >> first three forms could perhaps be merged since the ALL and DISTINCT >> keywords are effectively optional. > > Dunno, just seems harder to read to me... I'm generally for making the syntax part more succinct and addressing learning concerns with examples. The extra noise that needs to be filtered out when trying to figure out why different structures exist makes it difficult to read too. That said, having at least a bare-minimum expression would be helpful: aggregate_name ( expression ) And now decide whether to have a combined syntax block or keep building things up like: aggregate_name ( [ ALL | DISTINCT ] expression [ , ... ] [ order_by_clause] ) aggregate_name ( argument_clause ) [ FILTER ( WHERE [ filter_clause ] ) ] argument_clause := " [ ALL | DISTINCT ] expression [ , ... ] [ order_by_clause ] " If we are going to repeat long and complex parts of the syntax naming them will make reading subsequent syntax expressions easier and provide semantic meaning to the reader. The existing forms, while correct, are repetitive and that is what is being targeted but combining them into a single syntax block. But if that is too hard to read and understand then maybe some other means of simplification, like my example above, would work better. David J. -- View this message in context: http://postgresql.nabble.com/Aggregate-expression-syntax-tp5834726p5834768.html Sent from the PostgreSQL - docs mailing list archive at Nabble.com. -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs