Re: NULL-handling in aggregate(DISTINCT ...)

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: NULL-handling in aggregate(DISTINCT ...)
Date: 2009-11-12 01:45:33
Message-ID: 87vdhgtt4t.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
>> Now the question: If the limit of one argument for DISTINCT aggs were
>> removed (which I'm considering doing as part of an update to the
>> aggregate ORDER BY patch I posted a while back), what should be the
>> behaviour of agg(distinct x,y) where one or both of x or y is null?
>> And should it depend on the strictness of the transition function?

Tom> I think you could probably just change it: make DISTINCT work as
Tom> per regular DISTINCT (treat null like a value, keep one copy).
Tom> All the spec-conforming aggregates are strict and would ignore
Tom> the null in the next step anyway.

Change it for single-arg DISTINCT too? And the resulting change to the
established behaviour of array_agg is acceptable? Just want to be clear
here.

--
Andrew.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-11-12 02:02:32 Re: NULL-handling in aggregate(DISTINCT ...)
Previous Message Robert Haas 2009-11-12 01:42:45 Re: Unpredictable shark slowdown after migrating to 8.4