Database Exception: Order by clause not in select list incompatible with Distinct

Created on 27 April 2018, over 6 years ago
Updated 28 September 2023, over 1 year ago

The error only occures when Im not logged in and not on every forum.
My path is forum/23, I came from the forum list.

If I comment out $query->distinct(); at forum_access.module at line 424 the error is gone but I think there will be other problems with this.

Auf der Website ist ein unvorhergesehener Fehler aufgetreten. Bitte versuchen Sie es spΓ€ter nochmal.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: SQLSTATE[HY000]: General error: 3065 Expression #1 of ORDER BY clause is not in SELECT list, references column &#039;meta.t.weight&#039; which is not in SELECT list; this is incompatible with DISTINCT: SELECT DISTINCT t.tid AS tid
FROM 
{taxonomy_term_field_data} t
INNER JOIN {taxonomy_term_hierarchy} h ON h.parent = t.tid
LEFT OUTER JOIN {forum_access} fa ON fa.tid = t.tid
LEFT OUTER JOIN {acl} acl ON acl.figure = t.tid AND acl.module = &#039;forum_access&#039; AND acl.name=:name
LEFT OUTER JOIN {acl_user} aclu ON aclu.acl_id = acl.acl_id AND aclu.uid = :uid
WHERE (h.tid = :db_condition_placeholder_0) AND (t.default_langcode = :db_condition_placeholder_1) AND ((fa.rid IS NULL) OR ((fa.rid IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND (fa.grant_view &gt;= :db_condition_placeholder_4)) OR (aclu.uid = :db_condition_placeholder_5))
ORDER BY t.weight ASC, t.name ASC; Array
(
    [:db_condition_placeholder_0] =&gt; 23
    [:db_condition_placeholder_1] =&gt; 1
    [:db_condition_placeholder_2] =&gt; authenticated
    [:db_condition_placeholder_3] =&gt; mitglieder
    [:db_condition_placeholder_4] =&gt; 1
    [:db_condition_placeholder_5] =&gt; 36
    [:name] =&gt; moderate
    [:uid] =&gt; 36
)
 in <em class="placeholder">Drupal\taxonomy\TermStorage-&gt;loadParents()</em> (line <em class="placeholder">132</em> of <em class="placeholder">core/modules/taxonomy/src/TermStorage.php</em>). <pre class="backtrace">Drupal\Core\Database\Statement-&gt;execute(Array, Array) (Line: 625)
Drupal\Core\Database\Connection-&gt;query(&#039;SELECT DISTINCT t.tid AS tid
FROM 
{taxonomy_term_field_data} t
INNER JOIN {taxonomy_term_hierarchy} h ON h.parent = t.tid
LEFT OUTER JOIN {forum_access} fa ON fa.tid = t.tid
LEFT OUTER JOIN {acl} acl ON acl.figure = t.tid AND acl.module = &#039;forum_access&#039; AND acl.name=:name
LEFT OUTER JOIN {acl_user} aclu ON aclu.acl_id = acl.acl_id AND aclu.uid = :uid
WHERE (h.tid = :db_condition_placeholder_0) AND (t.default_langcode = :db_condition_placeholder_1) AND ((fa.rid IS NULL) OR ((fa.rid IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND (fa.grant_view &amp;gt;= :db_condition_placeholder_4)) OR (aclu.uid = :db_condition_placeholder_5))
ORDER BY t.weight ASC, t.name ASC&#039;, Array, Array) (Line: 87)
Drupal\Core\Database\Driver\mysql\Connection-&gt;query(&#039;SELECT DISTINCT t.tid AS tid
FROM 
{taxonomy_term_field_data} t
INNER JOIN {taxonomy_term_hierarchy} h ON h.parent = t.tid
LEFT OUTER JOIN {forum_access} fa ON fa.tid = t.tid
LEFT OUTER JOIN {acl} acl ON acl.figure = t.tid AND acl.module = &#039;forum_access&#039; AND acl.name=:name
LEFT OUTER JOIN {acl_user} aclu ON aclu.acl_id = acl.acl_id AND aclu.uid = :uid
WHERE (h.tid = :db_condition_placeholder_0) AND (t.default_langcode = :db_condition_placeholder_1) AND ((fa.rid IS NULL) OR ((fa.rid IN (:db_condition_placeholder_2, :db_condition_placeholder_3)) AND (fa.grant_view &amp;gt;= :db_condition_placeholder_4)) OR (aclu.uid = :db_condition_placeholder_5))
ORDER BY t.weight ASC, t.name ASC&#039;, Array, Array) (Line: 510)
Drupal\Core\Database\Query\Select-&gt;execute() (Line: 132)
Drupal\taxonomy\TermStorage-&gt;loadParents(&#039;23&#039;) (Line: 151)
Drupal\taxonomy\TermStorage-&gt;loadAllParents(&#039;23&#039;) (Line: 461)
Drupal\forum\ForumManager-&gt;getParents(&#039;23&#039;) (Line: 157)
Drupal\forum\Controller\ForumController-&gt;forumPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer-&gt;executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber-&gt;Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel-&gt;handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel-&gt;handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle-&gt;handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache-&gt;pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache-&gt;handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware-&gt;handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware-&gt;handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel-&gt;handle(Object, 1, 1) (Line: 664)
Drupal\Core\DrupalKernel-&gt;handle(Object) (Line: 19)
</pre>
πŸ› Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Gamewalker

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024