?
avatar mruivo
mruivo
12 Oct 2017

Steps to reproduce the issue

  1. Install Joomla! on Linux with Microsoft SQL drivers for Linux
  2. Go to home page or /administrator/index.php?option=com_content

Expected result

Displaying an article or list of articles

Actual result

[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Incorrect syntax near the keyword 'DISTINCT'.

System information (as much as possible)

PHP Built On: Linux 4.4.0-96-generic # 119-Ubuntu SMP Tue Sep 12 14:59:54 UTC 2017 x86_64
Database Version: 12.00.5207 (Microsoft SQL)
Database Driver on Linux: Microsoft Drivers for PHP for SQL Server
PHP Version: 7.0.22-0ubuntu0.16.04.1
Web Server: Apache/2.4.18 (Ubuntu)
WebServer to PHP Interface: fpm-fcgi
Joomla! Version: Joomla! 3.8.2-dev Development [ Amani ] 4-October-2017 14:00 GMT
Joomla! Platform Version: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

Additional comments

It appears the specific SQL that's causing this error is SELECT TOP 4 DISTINCT. A quick Google search tells me that for MSSQL it should instead be SELECT DISTINCT TOP 4. The full query generated by Joomla! is attached.

In the file \joomla\libraries\joomla\database\query\sqlsrv.php, when a limit is required, the function processLimit() replaces SELECT with SELECT TOP in the query. So if DISTINCT is in there, you get the above syntax error.

avatar mruivo mruivo - open - 12 Oct 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Oct 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 12 Oct 2017
Status New Closed
Closed_Date 0000-00-00 00:00:00 2017-10-12 10:53:43
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 12 Oct 2017
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 12 Oct 2017
avatar joomla-cms-bot
joomla-cms-bot - comment - 12 Oct 2017
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 12 Oct 2017

closed as having Pull Request #18315

avatar csthomas
csthomas - comment - 12 Oct 2017

@mruivo This PR should to be tested.
Please test patch from #18315 and if it is OK then mark test as success at https://issues.joomla.org/tracker/joomla-cms/18313

Add a Comment

Login with GitHub to post a comment