Unknown column group_relationship_field_data.tid in 'on clause

Created on 2 November 2023, about 1 year ago
Updated 30 January 2024, 11 months ago

Problem/Motivation

Many Views in Groups v4 error out with the SQL error in the issue title. I think whenever there's a view of an entity type that's related to another entity type.

Proposed resolution

Ensure that queries are only altered once.

NOTE: ignore the group_term fork. The problem is in Group module.

User interface changes

None

API changes

None

Data model changes

None

๐Ÿ› Bug report
Status

Closed: works as designed

Version

3.2

Component

Code

Created by

๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires

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

Merge Requests

Comments & Activities

  • Issue created by @vensires
  • Merge request !9Update views.view.group_terms.yml โ†’ (Closed) created by vensires
  • Status changed to Needs review about 1 year ago
  • Status changed to Needs work about 1 year ago
  • This is happening on my site with a node view when using a relationship on a taxonomy term field as well, so just fixing the included view probably won't be enough.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires

    Well, it could definitely be a starting point and we could address a wider usage in another issue.

    We should take into account though that the issue is that the group module and not the group_term module expects the base table the view plugin is used on top of, to be the base table of the entity. So, anything that doesnโ€™t fit this will eventually fail.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada dalin Guelph, ๐Ÿ‡จ๐Ÿ‡ฆ, ๐ŸŒ

    The problem is that \Drupal\group\QueryAccess\EntityQueryAlter::doAlter() is run twice on the same query, for each entity in the View.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡จ๐Ÿ‡ฆCanada dalin Guelph, ๐Ÿ‡จ๐Ÿ‡ฆ, ๐ŸŒ

    Here's a workaround to ensure that we don't alter the same query twice, but figuring out the root of the problem is beyond my skillset.

  • ๐Ÿ‡ซ๐Ÿ‡ฎFinland irowboat

    irowboat โ†’ changed the visibility of the branch 3398778- to active.

  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Hydra

    @dalin It looks to me that calling group_query_entity_query_alter in group_term_query_taxonomy_term_access_alter is the root of this problem. This has been introduced in https://www.drupal.org/project/group_term/issues/3367570 โœจ Add Group Ids to the Taxonomy Terms Fixed in order to solve some kind of permission issue when using entity_reference fields. They will give you access on all entities you have view access to, which might also be entities not part of the group. I believe this is the wrong attempt of solving this problem.

    I created an issue in group_term in order to revert this change: https://www.drupal.org/project/group_term/issues/3417876 ๐Ÿ› References are broken Active

    Not sure how to proceed with this issue. I don't believe that this has something to do with the group implementation since the issue is caused by group_term so I would suggest closing this as won't fix - but I only tested it with the Term usecase.

    The original creator reported that this happens with every view showing other entity types, so I'd like to verify if this was just a guess or another usecase we need to take in consideration first. @vensires

  • ๐Ÿ‡ฌ๐Ÿ‡ทGreece vensires

    @hydra, it's been some time now and I don't really remember. In most cases, when I write "Many Views" I tend to be as honest as possible. It might be though that all the pages where I got the issue were related to that one and only view.

  • Status changed to Closed: works as designed 11 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Hydra

    Thx @vensires for the quick response. So I would close this issue as works as designed. I created a fix for this in https://www.drupal.org/project/group_term/issues/3417876 ๐Ÿ› References are broken Active

Production build 0.71.5 2024