Re: Contradictory behavior of array_agg(distinct) aggregate.

2024-12-04 Thread Dagfinn Ilmari Mannsåker
Konstantin Knizhnik writes: > On 04/12/2024 9:03 am, Tom Lane wrote: >> Konstantin Knizhnik writes: >>> postgres=# create table t(x integer unique); >>> CREATE TABLE >>> postgres=# insert into t values (null),(null); >>> INSERT 0 2 >>> postgres=# select count(distinct x) from t; >>>  count >>>

Re: Contradictory behavior of array_agg(distinct) aggregate.

2024-12-03 Thread David G. Johnston
On Tuesday, December 3, 2024, Konstantin Knizhnik wrote: > > Is it only me who consider that current behavior of array_agg(distinct) > contradicts to interpretation of nulls in other cases ("null" is something > like "unknown" which means that we can not say weather two nulls are the > same or not

Re: Contradictory behavior of array_agg(distinct) aggregate.

2024-12-03 Thread Konstantin Knizhnik
On 04/12/2024 9:03 am, Tom Lane wrote: Konstantin Knizhnik writes: postgres=# create table t(x integer unique); CREATE TABLE postgres=# insert into t values (null),(null); INSERT 0 2 postgres=# select count(distinct x) from t;  count --- 0 (1 row) postgres=# select array_agg(dist

Re: Contradictory behavior of array_agg(distinct) aggregate.

2024-12-03 Thread Tom Lane
Konstantin Knizhnik writes: > postgres=# create table t(x integer unique); > CREATE TABLE > postgres=# insert into t values (null),(null); > INSERT 0 2 > postgres=# select count(distinct x) from t; >  count > --- > 0 > (1 row) > postgres=# select array_agg(distinct x) from t; >  array

Contradictory behavior of array_agg(distinct) aggregate.

2024-12-03 Thread Konstantin Knizhnik
Hi hackers! Is it only me who consider that current behavior of array_agg(distinct) contradicts to interpretation of nulls in other cases ("null" is something like "unknown" which means that we can not say weather two nulls are the same or not). This is why it is allowed to insert multiple n