From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ondřej Bouda <obouda@email.cz>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Wrong aggregate result when sorting by a NULL value
Date: Fri, 02 Nov 2018 11:07:31 -0400
Message-ID: <30923.1541171251@sss.pgh.pa.us> (raw)
In-Reply-To: <2a505161-2727-2473-7c46-591ed108ac52@email.cz>
References: <2a505161-2727-2473-7c46-591ed108ac52@email.cz>
=?UTF-8?Q?Ond=c5=99ej_Bouda?= <obouda@email.cz> writes:
> the following seems as a bug to me on Postgres 11.0:
Yeah, somebody broke this between 10.x and 11.0. You don't need the
custom aggregate, even plain min() fails:
regression=# SELECT min(x ORDER BY z) FROM t;
min
-----
(1 row)
while 10.5 delivers the expected result:
regression=# SELECT min(x ORDER BY z) FROM t;
min
-----
val
(1 row)
I've not looked at the code yet, but it's acting like somebody changed the
STRICT logic from "are any of the aggregate's arguments null" to "is any
part of the whole row (including ordering values) null". Wrong ...
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, obouda@email.cz
Subject: Re: Wrong aggregate result when sorting by a NULL value
In-Reply-To: <30923.1541171251@sss.pgh.pa.us>
References: <2a505161-2727-2473-7c46-591ed108ac52@email.cz> <30923.1541171251@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox