Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3oAv-0004Et-I3 for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Sep 2018 20:06:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3oAt-0004ch-8H for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Sep 2018 20:06:43 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3oAs-0004cR-Tk for pgsql-hackers@lists.postgresql.org; Sat, 22 Sep 2018 20:06:43 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3oAp-0000wo-6W for pgsql-hackers@postgresql.org; Sat, 22 Sep 2018 20:06:41 +0000 Received: from [192.168.127.1] (port=31177 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88 (FreeBSD)) (envelope-from ) id 1g3oAi-000As5-V2; Sat, 22 Sep 2018 20:06:32 +0000 Received: from [127.0.0.1] (port=61076 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.89 (FreeBSD)) (envelope-from ) id 1g3oAi-0008md-9Y; Sat, 22 Sep 2018 20:06:32 +0000 From: Andrew Gierth To: pgsql-hackers@postgresql.org Cc: david@fetter.org, Oliver Ford , Krasiyan Andreev Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options In-Reply-To: (Krasiyan Andreev's message of "Tue, 18 Sep 2018 15:05:07 +0300") Message-ID: <878t3vj279.fsf@news-spur.riddles.org.uk> References: <20180728185958.GP17411@fetter.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (berkeley-unix) Date: Sat, 22 Sep 2018 21:06:32 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Krasiyan" == Krasiyan Andreev writes: Krasiyan> Hi, Krasiyan> Patch applies and compiles, all included tests and building Krasiyan> of the docs pass. I am using last version from more than two Krasiyan> months ago in production environment with real data and I Krasiyan> didn't find any bugs, so I'm marking this patch as ready for Krasiyan> committer in the commitfest app. Unfortunately, reviewing it from a committer perspective - I can't possibly commit this as it stands, and anything I did to it would be basically a rewrite of much of it. Some of the problems could be fixed. For example the type names could be given pg_* prefixes (it's clearly not acceptable to create random special-purpose boolean subtypes in pg_catalog and _not_ give them such a prefix), and the precedence hackery in gram.y could have comments added (gram.y is already bad enough; _anything_ fancy with precedence has to be described in the comments). But I don't like that hack with the special types at all, and I think that needs a better solution. Normally I'd push hard to try and get some solution that's sufficiently generic to allow user-defined functions to make use of the feature. But I think the SQL spec people have managed to make that literally impossible in this case, what with the FROM keyword appearing in the middle of a production and not followed by anything sufficiently distinctive to even use for extra token lookahead. Also, as has been pointed out in a number of previous features, we're starting to accumulate identifiers that are reserved in subtly different ways from our basic four-category system (which is itself a significant elaboration compared to the spec's simple reserved/unreserved distinction). As I recall this objection was specifically raised for CUBE, but justified there by the existence of the contrib/cube extension (and the fact that the standard CUBE() construct is used only in very specific places in the syntax). This patch would make lead / lag / first_value / last_value / nth_value syntactically "special" while not actually reserving them (beyond having them in unreserved_keywords); I think serious consideration should be given to whether they should instead become col_name_keywords (which would, I believe, make it unnecessary to mess with precedence). Anyone have any thoughts or comments on the above? -- Andrew (irc:RhodiumToad)