Re: array_agg and array_accum (patch)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ian Caulfield" <ian(dot)caulfield(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Jeff Davis <pgsql(at)j-davis(dot)com>
Subject: Re: array_agg and array_accum (patch)
Date: 2008-10-27 03:02:59
Message-ID: 29750.1225076579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Ian Caulfield" <ian(dot)caulfield(at)gmail(dot)com> writes:
> I think array_agg also keeps nulls - although the draft standard I
> have seems to contradict itself about this...

The SQL:2008 draft I have says, in 10.9 <aggregate function> general
rule 8g

NOTE 267 - Null values are not eliminated when computing <array
aggregate function>. This, plus the optional <sort specification
list>, sets <array aggregate function> apart from <general set
function>s.

So that seems to make it perfectly clear that nulls aren't eliminated,
and furthermore to be an intentional override of any other part of the
spec that you might think says nulls should be eliminated. If you have
an argument to read it otherwise, please say exactly what.

A larger objection to Jeff's draft patch is that it doesn't implement
the <sort specification list>. I'm entirely happy about not doing that
--- the current SQL committee's willingness to invent random new syntax
and nonorthogonal behavior for every function they can think of will be
the death of SQL yet --- but it's something that we at least need to
document the workaround for.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-10-27 07:25:10 Re: WIP patch: convert SQL-language functions to return tuplestores
Previous Message Martin Gainty 2008-10-27 02:28:25 Re: again... (win32 logging errors)