Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l36V5-0000Nx-12 for pgsql-committers@arkaria.postgresql.org; Sat, 23 Jan 2021 00:09:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l36V3-0006bn-Kj for pgsql-committers@arkaria.postgresql.org; Sat, 23 Jan 2021 00:09:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l36V3-0006aU-FD for pgsql-committers@lists.postgresql.org; Sat, 23 Jan 2021 00:09:57 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l36V1-0007wT-62 for pgsql-committers@lists.postgresql.org; Sat, 23 Jan 2021 00:09:56 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1l36V0-0003QA-Ge; Fri, 22 Jan 2021 19:09:54 -0500 Date: Fri, 22 Jan 2021 19:09:54 -0500 From: Bruce Momjian To: Tom Lane Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions. Message-ID: <20210123000954.GB25546@momjian.us> References: <20210123000420.GA25546@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210123000420.GA25546@momjian.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jan 22, 2021 at 07:04:20PM -0500, Bruce Momjian wrote: > On Fri, Jan 22, 2021 at 09:26:29PM +0000, Tom Lane wrote: > > Re-allow DISTINCT in pl/pgsql expressions. > > > > I'd omitted this from the grammar in commit c9d529848, figuring that > > it wasn't worth supporting. However we already have one complaint, > > so it seems that judgment was wrong. It doesn't require a huge > > amount of code, so add it back. (I'm still drawing the line at > > UNION/INTERSECT/EXCEPT though: those'd require an unreasonable > > amount of grammar refactoring, and the single-result-row restriction > > makes them near useless anyway.) > > > > Also rethink the documentation: this behavior is a property of > > all pl/pgsql expressions, not just assignments. > > > > Discussion: https://postgr.es/m/20210122134106.e94c5cd7@mail.verfriemelt.org > > I am seeing a warning generated by preproc.y, which is generated via > Perl from gram.y, which was modified by this commit. The bison output > is: > > $ /usr/bin/bison -Wno-deprecated -d -o preproc.c preproc.y > preproc.y: warning: 1 nonterminal useless in grammar [-Wother] > preproc.y: warning: 2 rules useless in grammar [-Wother] > preproc.y:10134.2-20: warning: nonterminal useless in grammar: opt_distinct_clause [-Wother] > opt_distinct_clause: > ^~~~~~~~~~~~~~~~~~~ > > I only see it when I do a "make maintainer-clean" before the make > because "make clean" does not remove preproc.y. Sorry, this is Bison version 3.3.2, included in Debian 10. -- Bruce Momjian https://momjian.us EDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee