Problem/Motivation

I tried to get the file URI of the user picture so I created a user based view and tried to add a relationship to User: Picture. Sadly I got following error directly after adding the relationship:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'file_managed_user__user_picture.target_id' in 'on clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {users} users INNER JOIN {users_field_data} users_field_data ON users.uid = users_field_data.uid LEFT JOIN {user__user_picture} user__user_picture ON users_field_data.uid = user__user_picture.entity_id AND (user__user_picture.deleted = :views_join_condition_0 AND user__user_picture.langcode = users_field_data.langcode) LEFT JOIN {file_managed} file_managed_user__user_picture ON user__user_picture.user_picture_target_id = file_managed_user__user_picture.target_id WHERE (( (users_field_data.status <> :db_condition_placeholder_0) ))) subquery; Array ( [:db_condition_placeholder_0] => 0 [:views_join_condition_0] => 0 )

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Bug
Prioritized changes The main goal of this issue is a bug fix.
Disruption None
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geertvd’s picture

Status: Active » Needs review
FileSize
1.15 KB

Was able reproduce this.
Patch fixed the issue for me.

geertvd’s picture

Issue tags: +VDC
yannickoo’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
366.64 KB

Oh yeah your patch made it!

dawehner’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Thank you for creating a patch!

Did someone considered writing a test?

geertvd’s picture

Assigned: Unassigned » geertvd

I'll write up a test for this.

geertvd’s picture

Status: Needs work » Needs review
FileSize
10.82 KB
11.97 KB

Added a test for image and file.

The last submitted patch, 6: 2417625-6.tests_.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 6: 2417625-6.complete.patch, failed testing.

Status: Needs work » Needs review

geertvd queued 6: 2417625-6.complete.patch for re-testing.

geertvd queued 6: 2417625-6.tests_.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 6: 2417625-6.complete.patch, failed testing.

The last submitted patch, 6: 2417625-6.tests_.patch, failed testing.

Status: Needs work » Needs review

geertvd queued 6: 2417625-6.complete.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 6: 2417625-6.complete.patch, failed testing.

geertvd’s picture

The last submitted patch, 15: 2417625-15-tests.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 15: 2417625-15-complete.patch, failed testing.

geertvd’s picture

FileSize
10.63 KB
418.56 KB
geertvd’s picture

Status: Needs work » Needs review

The last submitted patch, 18: 2417625-18-tests.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 18: 2417625-18-complete.patch, failed testing.

Status: Needs work » Needs review

geertvd queued 18: 2417625-18-complete.patch for re-testing.

geertvd’s picture

FileSize
10.63 KB
11.78 KB

Something went wrong when I created that last patch.

The last submitted patch, 18: 2417625-18-complete.patch, failed testing.

The last submitted patch, 23: 2417625-20-tests.patch, failed testing.

Lendude’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -Needs tests

nitpicking:

  1. +++ b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
    @@ -0,0 +1,99 @@
    + * Contains \Drupal\image\Tests\Views\RelationshipUserFileDataTest.
    

    Should be \Drupal\file\Tests....

  2. +++ b/core/modules/file/src/Tests/Views/RelationshipUserFileDataTest.php
    @@ -0,0 +1,99 @@
    +
    +
    

    double newline

  3. +++ b/core/modules/image/src/Tests/Views/RelationshipUserImageDataTest.php
    @@ -0,0 +1,99 @@
    +
    

    double newline

fix looks good, nice tests.

Added beta evaluation.

geertvd’s picture

Status: Needs work » Needs review
FileSize
1.27 KB
10.63 KB
11.77 KB

Fixed those small formatting issues.
Thanks for adding the beta evaluation.

The last submitted patch, 27: 2417625-27-tests.patch, failed testing.

Lendude’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 4210a02 and pushed to 8.0.x. Thanks!

  • alexpott committed 4210a02 on 8.0.x
    Issue #2417625 by geertvd, yannickoo: "Column not found" when adding...

Status: Fixed » Closed (fixed)

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