Problem/Motivation

When I try to filter by content tags on /all-topics page, I receive a wsod. When looking through the logs, it shows up an SQL error:

Drupal\Core\Database\DatabaseExceptionWrapper: Exception in Latest topics[latest_topics]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= '9')) subquery' at line 6: SELECT COUNT(*) AS expression FROM (SELECT DISTINCT node_field_data.created AS node_field_data_created, node_field_data.nid AS nid, 1 AS expression FROM {node_field_data} node_field_data WHERE (node_field_data.status = :db_condition_placeholder_0) AND (node_field_data.type IN (:db_condition_placeholder_1)) AND (.social_tagging_target_id = :db_condition_placeholder_2)) subquery; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => topic [:db_condition_placeholder_2] => 9 ) in Drupal\views\Plugin\views\query\Sql->execute() (line 1543 of /var/www/html/docroot/core/modules/views/src/Plugin/views/query/Sql.php).

Steps to reproduce

1. Enable social_tagging module.
2. Enable tagging for all types (groups,topics,profiles...).
3. Create some tags and tag a topic with it.
4. Go to /all-topics page and try to filter by some tag.

Proposed resolution

In SocialTaggingOverrides.php, when overriding the view config, it will always try to join profile__social_tag table (when profile tagging is enabled), but this is not correct behavior, because if you are on /all-topics it should use node__social_tag table, since it will filter through nodes and not profiles. So this code needs to be changed, so it only uses the profile__social_tag table when on user views.

Remaining tasks

/

User interface changes

/

API changes

/

Data model changes

/

Comments

nkoporec created an issue. See original summary.

nkoporec’s picture

Component: Code (back-end) » Tagging
nkoporec’s picture

Status: Active » Needs review

  • 03c3e1e committed on 10.3.x
    Merge pull request #2399 from goalgorilla/issue-3222130-cant-filter-by-...

  • 587a999 committed on 10.2.x
    Merge pull request #2399 from goalgorilla/issue-3222130-cant-filter-by-...
tbsiqueira’s picture

Status: Needs review » Fixed
tbsiqueira’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.