Bug 3875

Summary: Adding support for DISTINCT in custom single-argument aggregates
Product: SQL Reporter: Frédéric Jolliton <frederic.jolliton+monetdb>
Component: allAssignee: SQL devs <bugs-sql>
Status: NEW ---    
Severity: enhancement    
Priority: Normal    
Version: -- development   
Hardware: x86_64 (amd64/em64t)   
OS: Linux   

Description Frédéric Jolliton 2015-11-23 18:24:48 CET
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Build Identifier: 

That's probably more a feature request that a bug per se.

We have implemented various aggregates functions in C for MonetDB, such as "concat" to concatenate all the strings of a column, separated by comma. (These aggregates works fine and are pretty generics, and we plan to release the code for them if there are any interest.)

With PostgreSQL it is possible to use the DISTINCT keyword within a single argument aggregate function, such that "concat(DISTINCT name)" behave by concatenating only distinct names, which is very convenient (like SUM(DISTINCT value) that sums only distinct values for instance.)

But it seems that MonetDB can't even parse it. This is rejected right when reading the SQL query:

    syntax error, unexpected IDENT, expecting ')' or ',' in: "select concat(distinct name"

Is this feature planned to be supported at some point?

Reproducible: Always