Invalid SQL on representative node views

Created on 9 November 2023, 10 months ago
Updated 13 November 2023, 10 months ago

Problem

Wrong column uid1 when I use representative nodes twice in a view.
Drupal\Core\Database\DatabaseExceptionWrapper: Exception in test_attachment[test_attachment]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'users_field_data.uid1' in 'where clause': SELECT DISTINCT "users_field_data"."langcode" AS "users_field_data_langcode", "users_field_data"."uid" AS "uid", "node_field_data_users_field_data"."langcode" AS "node_field_data_users_field_data_langcode", "node_field_data_users_field_data"."nid" AS "node_field_data_users_field_data_nid" FROM "users_field_data" "users_field_data" INNER JOIN "node_field_data" "node_field_data_users_field_data" ON (SELECT "node_field_dataINNER"."nid" AS "nidINNER" FROM "node_field_data" "node_field_dataINNER" LEFT JOIN "users_field_data" "users_field_data_node_field_dataINNER" ON "node_field_dataINNER".uid = "users_field_data_node_field_dataINNER".uid WHERE ("users_field_data_node_field_dataINNER".uid = users_field_data.uid1) ORDER BY "node_field_dataINNER"."created" DESC LIMIT 1 OFFSET 0) = node_field_data_users_field_data.nid WHERE ("users_field_data"."status" = :db_condition_placeholder_0) AND ("node_field_data_users_field_data"."status" = :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => 1 ) in main() (line 19 of index.php).

Steps to reproduce

Create a views page with user and a attachment, both with representative Nodes. The view works after save the relationsship, after clearing the cache the SQL error appears.

Drupal 10.1

πŸ› Bug report
Status

Active

Version

10.1 ✨

Component
ViewsΒ  β†’

Last updated about 14 hours ago

Created by

πŸ‡©πŸ‡ͺGermany Bruno2

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024