From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)postgresql(dot)org> |
Cc: | "ojford(at)gmail(dot)com" <ojford(at)gmail(dot)com>, "vik(at)postgresfriends(dot)org" <vik(at)postgresfriends(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "andrew(at)tao11(dot)riddles(dot)org(dot)uk" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "david(at)fetter(dot)org" <david(at)fetter(dot)org>, "krasiyan(at)gmail(dot)com" <krasiyan(at)gmail(dot)com> |
Subject: | Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options |
Date: | 2024-09-12 02:11:35 |
Message-ID: | CAKFQuwamWORs6WJ+ftCRUC1yh8k-b0Ny5G5ryD7_m9u+B94SHA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wednesday, September 11, 2024, Tatsuo Ishii <ishii(at)postgresql(dot)org> wrote:
>
> test=# SELECT row_number() IGNORE NULLS OVER w FROM t1 WINDOW w AS (ORDER
> BY i);
> row_number
> ------------
> 1
> 2
> (2 rows)
>
> The t1 table only contains NULL rows. By using IGNORE NULLS, I think
> it's no wonder that a user expects 0 rows returned, if there's no
> mention in the docs that actually IGNORE NULLS/RESPECT NULLS are just
> ignored in some window functions.
>
My nieve understanding of the nulls treatment is computations are affected,
therefore a zero-argument function is incapable of abiding by this clause
(it should error…). Your claim that this should somehow produce zero rows
confuses me on two fronts. One, window function should be incapable of
affecting how many rows are returned. The query must output two rows
regardless of the result of the window expression (it should at worse
produce the null value). Two, to produce said null value you have to be
ignoring the row due to the order by clause seeing a null. But the order
by isn’t part of the computation.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-09-12 02:19:00 | Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch |
Previous Message | David Rowley | 2024-09-12 02:07:37 | Re: Opinion poll: Sending an automated email to a thread when it gets added to the commitfest |