public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andrew Gierth <[email protected]>
To: Tom Lane <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Oliver Ford <[email protected]>
Cc: Krasiyan Andreev <[email protected]>
Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Date: Tue, 25 Sep 2018 05:16:27 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CAGMVOdsbtRwE_4+v8zjH1d9xfovDeQAGLkP_B6k69_VoFEgX-A@mail.gmail.com>
<[email protected]>
<CAN1PwonR8uFAN-cCYRB1eReyNFNSdMtvJFYHWdmp=vCoGxuKdQ@mail.gmail.com>
<[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
So I've tried to rough out a decision tree for the various options on
how this might be implemented (discarding the "use precedence hacks"
option). Opinions? Additions?
(formatted for emacs outline-mode)
* 1. use lexical lookahead
+: relatively straightforward parser changes
+: no new reserved words
+: has the option of working extensibly with all functions
-: base_yylex needs extending to 3 lookahead tokens
** 1.1. Allow from/ignore clause on all (or all non-agg) window function calls
If the clauses are legal on all window functions, what to do about existing
window functions for which the clauses do not make sense?
*** 1.1.1. Ignore the clause when the function isn't aware of it
+: simple
-: somewhat surprising for users perhaps?
*** 1.1.2. Change the behavior of the windowapi in some consistent way
Not sure if this can work.
+: fairly simple(maybe?) and predictable
-: changes the behavior of existing window functions
** 1.2. Allow from/ignore clause on only certain functions
+: avoids any unexpected behavior
-: needs some way to control what functions allow it
*** 1.2.1. Check the function name in parse analysis against a fixed list.
+: simple
-: not extensible
*** 1.2.2. Provide some option in CREATE FUNCTION
+: extensible
-: fairly intrusive, adding stuff to create function and pg_proc
*** 1.2.3. Do something magical with function argument types
+: doesn't need changes in create function / pg_proc
-: it's an ugly hack
* 2. reserve nth_value etc. as functions
+: follows the spec reasonably well
+: less of a hack than extending base_yylex
-: new reserved words
-: more parser rules
-: not extensible
(now goto 1.2.1)
* 3. "just say no" to the spec
e.g. add new functions like lead_ignore_nulls(), or add extra boolean
args to lead() etc. telling them to skip nulls
+: simple
-: doesn't conform to spec
-: using extra args isn't quite the right semantics
--
Andrew (irc:RhodiumToad)
view thread (91+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox