[TYPO3-core] FYI #16455: DISTINCT as a function is not compatible with DBAL

Xavier Perseguers typo3 at perseguers.ch
Thu Nov 18 08:44:15 CET 2010


Hi,

> On 17-11-2010 23:12, Xavier Perseguers wrote:
>> Problem:
>> EM tool is using DISTINCT keyword as a function:
>>
>> SELECT COUNT(DISTINCT(column)) ...
>>
>> instead of the DBAL compatible way:
>>
>> SELECT COUNT(DISTINCT column)
>
> I've searched the MySQL documentation, but I can't find any reference to
> using DISTINCT as a function. I haven't found any difference between
> using DISTINCT and DISTINCT(), so I'm getting more and more convinced
> that MySQL interpretes the "function" as the keyword DISTINCT plus an
> expression which is surrounded by parentheses (which is allowed):
>
> SELECT COUNT(DISTINCT (column) ) ...
>
> or you could write:
>
> SELECT COUNT(DISTINCT ((((column)))) ) ...

Interesting point of view. But in that case, I'd bet that the persons 
writing the DISTINCT think of it as a function just as MAX(), MIN() or 
COUNT().

> It has the same result as:
>
> SELECT COUNT(DISTINCT`column`) ...
>
> Maybe you can tell more about how other DBMSs deal with spaces between
> keywords and expressions? Is this documented in the
> DBAL-compatible-query-rules?

Problem is this one: http://bugs.typo3.org/view.php?id=12865

Cheers
Xavier


More information about the TYPO3-team-core mailing list