Skip to content

PostgreSQL - MSSQL wrong group by on categories#8221

Closed
alikon wants to merge 3 commits intojoomla:3.5-devfrom
alikon:patch-43
Closed

PostgreSQL - MSSQL wrong group by on categories#8221
alikon wants to merge 3 commits intojoomla:3.5-devfrom
alikon:patch-43

Conversation

@alikon
Copy link
Copy Markdown
Contributor

@alikon alikon commented Oct 31, 2015

Steps to reproduce the issue

administration->content->categories

Actual result

j35 administration

wrong SQL group by for postgresql & mssql in administration->content->categories

After patch

j35 administration articles categories

wrong group by for postgresql in administration->content->categories
@waader
Copy link
Copy Markdown
Contributor

waader commented Nov 1, 2015

Works with postgres and mysql, not with mssql. I didn´t work with mssql before.

Error

[Microsoft][SQL Server Native Client 11.0][SQL Server]Column '#__categories.title' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. SQL=SELECT a.id, a.title, a.alias, a.note, a.published, a.access, a.checked_out, a.checked_out_time, a.created_user_id, a.path, a.parent_id, a.level, a.lft, a.rgt, a.language,l.title AS language_title,uc.name AS editor,ag.title AS access_level,ua.name AS author_name,COUNT(DISTINCT cp.id) AS count_published,COUNT(DISTINCT cu.id) AS count_unpublished,COUNT(DISTINCT ca.id) AS count_archived,COUNT(DISTINCT ct.id) AS count_trashed FROM #__categories AS a LEFT JOIN [#__languages] AS l ON l.lang_code = a.language LEFT JOIN #__users AS uc ON uc.id=a.checked_out LEFT JOIN #__viewlevels AS ag ON ag.id = a.access LEFT JOIN #__users AS ua ON ua.id = a.created_user_id LEFT JOIN #__content AS cp ON cp.catid = a.id AND cp.state = 1 LEFT JOIN #__content AS cu ON cu.catid = a.id AND cu.state = 0 LEFT JOIN #__content AS ca ON ca.catid = a.id AND ca.state = 2 LEFT JOIN #__content AS ct ON ct.catid = a.id AND ct.state = -2 WHERE a.extension = 'com_content' AND (a.published IN (0, 1)) GROUP BY a.id, l.title, uc.name, ag.title, ua.name ORDER BY a.lft asc [Microsoft][SQL Server Native Client 11.0][SQL Server]Column '#__categories.title' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. SQL=SELECT * FROM ( SELECT a.id, a.title, a.alias, a.note, a.published, a.access, a.checked_out, a.checked_out_time, a.created_user_id, a.path, a.parent_id, a.level, a.lft, a.rgt, a.language,l.title AS language_title,uc.name AS editor,ag.title AS access_level,ua.name AS author_name,COUNT(DISTINCT cp.id) AS count_published,COUNT(DISTINCT cu.id) AS count_unpublished,COUNT(DISTINCT ca.id) AS count_archived,COUNT(DISTINCT ct.id) AS count_trashed , ROW_NUMBER() OVER (ORDER BY a.lft asc) AS RowNumber FROM #__categories AS a LEFT JOIN [#__languages] AS l ON l.lang_code = a.language LEFT JOIN #__users AS uc ON uc.id=a.checked_out LEFT JOIN #__viewlevels AS ag ON ag.id = a.access LEFT JOIN #__users AS ua ON ua.id = a.created_user_id LEFT JOIN #__content AS cp ON cp.catid = a.id AND cp.state = 1 LEFT JOIN #__content AS cu ON cu.catid = a.id AND cu.state = 0 LEFT JOIN #__content AS ca ON ca.catid = a.id AND ca.state = 2 LEFT JOIN #__content AS ct ON ct.catid = a.id AND ct.state = -2 WHERE a.extension = 'com_content' AND (a.published IN (0, 1)) GROUP BY a.id, l.title, uc.name, ag.title, ua.name ) A WHERE A.RowNumber BETWEEN 1 AND 20 [Microsoft][SQL Server Native Client 11.0][SQL Server]Column '#__categories.title' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. SQL=SELECT a.id, a.title, a.alias, a.note, a.published, a.access, a.checked_out, a.checked_out_time, a.created_user_id, a.path, a.parent_id, a.level, a.lft, a.rgt, a.language,l.title AS language_title,uc.name AS editor,ag.title AS access_level,ua.name AS author_name,COUNT(DISTINCT cp.id) AS count_published,COUNT(DISTINCT cu.id) AS count_unpublished,COUNT(DISTINCT ca.id) AS count_archived,COUNT(DISTINCT ct.id) AS count_trashed FROM #__categories AS a LEFT JOIN [#__languages] AS l ON l.lang_code = a.language LEFT JOIN #__users AS uc ON uc.id=a.checked_out LEFT JOIN #__viewlevels AS ag ON ag.id = a.access LEFT JOIN #__users AS ua ON ua.id = a.created_user_id LEFT JOIN #__content AS cp ON cp.catid = a.id AND cp.state = 1 LEFT JOIN #__content AS cu ON cu.catid = a.id AND cu.state = 0 LEFT JOIN #__content AS ca ON ca.catid = a.id AND ca.state = 2 LEFT JOIN #__content AS ct ON ct.catid = a.id AND ct.state = -2 WHERE a.extension = 'com_content' AND (a.published IN (0, 1)) GROUP BY a.id, l.title, uc.name, ag.title, ua.name ORDER BY a.lft asc


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8221.

forgot of mssql strict
@alikon
Copy link
Copy Markdown
Contributor Author

alikon commented Nov 1, 2015

should work on mssql too

@alikon alikon changed the title PostgreSQL - wrong group by on categories PostgreSQL - MSSQL wrong group by on categories Nov 1, 2015
fix for Line exceeds 150 characters;
@waader
Copy link
Copy Markdown
Contributor

waader commented Nov 1, 2015

I have tested this item ✅ successfully on 4a1b982

Thanks alikon!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8221.

@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 1, 2015

I have tested this item ✅ successfully on 4a1b982

Works great here on mysql too. Thanks.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8221.

@zero-24 zero-24 added this to the Joomla! 3.5.0 milestone Nov 1, 2015
@zero-24
Copy link
Copy Markdown
Contributor

zero-24 commented Nov 1, 2015

RTC @roland-d makre sure this gets merged into staging as well 😃


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/8221.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 1, 2015
@roland-d roland-d closed this in 4373019 Nov 2, 2015
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Nov 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants