**TROUBLESHOOTING**
* If your menu children aren't showing up, check the following
- Are you providing the correct parent ID in your contextual filter? The
simplest way to do this is to select:
"Provide default value" -> "Content ID from URL"

But when I do that, I get
Drupal\Core\Database\IntegrityConstraintViolationException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'nid' in where clause is ambiguous: SELECT node.nid AS node_nid, node_field_data.nid AS nid FROM {node_field_data} node_field_data INNER JOIN {node} node ON node_field_data.nid = node.nid WHERE (( (nid IN (:node_menu_children_filter__0)) )AND(( (node_field_data.status = :db_condition_placeholder_0) ))); Array ( [:db_condition_placeholder_0] => 1 [:node_menu_children_filter__0] => 18 ) in Drupal\Core\Database\Connection->handleQueryException() (regel 668 van /core/lib/Drupal/Core/Database/Connection.php).

I haven't sorted on weight or anything.

If I have no contextual filter, all nodes are showing (offcourse).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fotograafinge created an issue. See original summary.

bmcclure’s picture

Hmm, I definitely see the problem with the query, but I'm not positive where it comes from yet. Could you export your view (or a simplified one if it relies on a lot of other things) and add post the .yml? Or if it's a really simple view, could you post reproduction steps from a scratch? Thanks!

bmcclure’s picture

Assigned: Unassigned » bmcclure
fotograafinge’s picture

Just a real simple view.

An unsorted list of fields, no filters, no relations, nothing special.

jeremygrajales’s picture

I'm also seeing this issue.
If my view is using fields and I only list the "title" of the node, everything returns fine.

In my case, I need the path alias of the node as well. Adding this field results in the same exception from OP.

jeremygrajales’s picture

This patch works for me

fotograafinge’s picture

thx @jeremygrajales, that patch solves the problem !!
the patch from #6 works for me too

jeremygrajales’s picture

It only works if you're using a node field in your view (which is most cases where you would run into this issue).

If you're using just the title field, Drupal doesn't do a join on the node table and this patch will cause another exception.
I don't have a lot of exp. with Views API, so maybe someone can find a better solution?

bmcclure’s picture

Thanks for the patch! This problem hadn't appeared for me because I usually use rendered entities in my views.

That little snippet of code that defaults to "nid" if there's no table alias, I think a better solution for that might be needed altogether. It doesn't seem like that should be needed, but when I was testing originally there was not always a table alias specified. I feel like there should be a better solution for assigning the name to that field in the query, however, that doesn't involve a conditional at all.

I may not have time to look more into this until next week, finishing up a big project at the moment, however if anyone else finds a solution to that before me (or finds that I'm wrong and we need that conditional after all), that'd be great as well.

bmcclure’s picture

Status: Active » Needs work
cravecode’s picture

This should be fixed in the 7.x work i'm bringing into 8.x. I hope to have the 8.x dev branch updated this week.

bmcclure’s picture

Assigned: bmcclure » Unassigned

Sounds great! Unassigned from me for now until you bring that code over and we see if this is resolved.

cravecode’s picture

@fotograafinge, can you please test out the new 8.x-2.x branch?

cravecode’s picture

Status: Needs work » Needs review
cravecode’s picture

@fotograafinge, can you try the latest 8.x beta?

cravecode’s picture

@fotograafinge hasn't responded. @bmcclure where you able to reproduce this? If so, do you know if it's fixed in the latest beta?

fotograafinge’s picture

I'm sorry. Will check it asap!

bmcclure’s picture

I wasn't able to reproduce myself previously btw. I hope that means it's been fixed since, but perhaps @fotograafinge can let us know for sure.

cravecode’s picture

Status: Needs review » Fixed

I'm closing this issue. With the latest work, the join is handled very differently.

cravecode’s picture

Status: Fixed » Closed (fixed)