Views list of terms results in duplicate records because JOIN does not include langcode

Created on 10 January 2025, 5 days ago

Problem/Motivation

When building a view of terms which have translation enabled, the results will show multiple records even though the language filter is set to only show a specific language.

Here's the query that Views generates:

SELECT "taxonomy_term_field_data"."langcode" AS "taxonomy_term_field_data_langcode", "taxonomy_term_field_data"."tid" AS "tid"
FROM
{taxonomy_term_field_data} "taxonomy_term_field_data"
ORDER BY "taxonomy_term_field_data"."tid" DESC

Steps to reproduce

Configure the site with multiple languages.
Set up terms to be translatable.
Translate a few terms.
Build a view that lists taxonomy data; add a filter for the original language.
Display the view, filter the list to only show a single language.

Proposed resolution

Add an extra JOIN definition between the taxonomy_term_data and taxonomy_term_field_data on the "langcode" field.

Remaining tasks

Fix the term data JOIN.

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

10.3 ✨

Component

views.module

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

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

Comments & Activities

Production build 0.71.5 2024