Re: Aggregation results with json(b)_agg and array_agg in a SELECT with OUTER JOIN

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Aggregation results with json(b)_agg and array_agg in a SELECT with OUTER JOIN
Дата
Msg-id CAKFQuwa_S4GzcHvgJ2B24yWoZDVD_Fwa-4cwBaNi8QrUYbQybw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Aggregation results with json(b)_agg and array_agg in a SELECT with OUTER JOIN  (sulfinu@gmail.com)
Список pgsql-bugs
On Fri, May 19, 2023 at 9:59 AM <sulfinu@gmail.com> wrote:
I've adjusted the statements so that you can clearly see that there is a difference between a missing outer-joined entity and its columns being actually set to NULL:
Therefore, it is a bug.

Yep, the output of a left join, so far as the implicit composite (row?) type produced for the nullable relation is concerned, has a form that depends on whether or not a match was found.  i.e., the system produces null::b for a non-match.  Its a reasonable way to express "no match present".  And in the presence of an aggregate checking for {NULL} versus {(,)} to differentiate the two cases is actually doable (see NULLIF())

A bug is "something that isn't working as designed" but you haven't said what design you are taking to be authoritative.  Different queries and data producing different outputs is something that usually is beneficial.

David J.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: initdb faild to initialize full text search dictionaries
Следующее
От: "396934406"
Дата:
Сообщение: ERROR: CREATE DATABASE cannot be executed within a pipeline