Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: pgsql-hackers@postgresql.org, david@fetter.org,
Oliver Ford <ojford@gmail.com>, Krasiyan Andreev <krasiyan@gmail.com>
Date: 2018-09-25T14:07:19Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix coding style with "else".
- 20628b62e46e 19 (unreleased) landed
-
Fix multi WinGetFuncArgInFrame/Partition calls with IGNORE NULLS.
- 2d7b247cb414 19 (unreleased) landed
-
Fix Coverity issue reported in commit 2273fa32bce.
- dd766a441d69 19 (unreleased) landed
-
Use ereport rather than elog in WinCheckAndInitializeNullTreatment.
- 5f3808646f67 19 (unreleased) landed
-
Avoid uninitialized-variable warnings from older compilers.
- 71540dcdcb22 19 (unreleased) cited
-
Fix Coverity issues reported in commit 25a30bbd423.
- 2273fa32bce7 19 (unreleased) landed
-
Improve EXPLAIN's display of window functions.
- 8b1b342544b6 18.0 cited
-
Automatically generate node support functions
- 964d01ae90c3 16.0 cited
Andrew Gierth <andrew@tao11.riddles.org.uk> writes: > 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? I think it'd be worth at least drafting an implementation for the lexical-lookahead fix. I think it's likely that we'll need to extend base_yylex to do more lookahead in the future even if we don't do it for this, given the SQL committee's evident love for COBOL-ish syntax and lack of regard for what you can do in LALR(1). The questions of how we interface to the individual window functions are really independent of how we handle the parsing problem. My first inclination is to just pass the flags down to the window functions (store them in WindowObject and provide some additional inquiry functions in windowapi.h) and let them deal with it. > If the clauses are legal on all window functions, what to do about existing > window functions for which the clauses do not make sense? Option 1: do nothing, document that nothing happens if w.f. doesn't implement it. Option 2: record whether the inquiry functions got called. At end of query, error out if they weren't and the options were used. It's also worth wondering if we couldn't just implement the flags in some generic fashion and not need to involve the window functions at all. FROM LAST, for example, could and perhaps should be implemented by inverting the sort order. Possibly IGNORE NULLS could be implemented inside the WinGetFuncArgXXX functions? These behaviors might or might not make much sense with other window functions, but that doesn't seem like it's our problem. regards, tom lane