| Project: | Drupal core |
| Version: | 8.x-dev |
| Component: | aggregator.module |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (to be ported) |
| Issue tags: | Needs backport to D8 |
Issue Summary
When attempting to use the Contextual filter to select a specific Aggregator item, I get the following error:
Notice: Undefined index: highlighted in include() (line 109 of .../sites/all/themes/crcom/page.tpl.php).
Warning: Illegal offset type in SelectQuery->fields() (line 1330 of .../includes/database/select.inc).
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM aggregator_item aggregator_item WHERE (iid IN ('45'))' at line 1: SELECT FROM {aggregator_item} aggregator_item WHERE (iid IN (:db_condition_placeholder_0)) ; Array ( [:db_condition_placeholder_0] => 45 ) in views_handler_argument_aggregator_iid->title_query() (line 17 of .../sites/all/modules/views/modules/aggregator/views_handler_argument_aggregator_iid.inc).
It seems to be a problem with a lack of a table alias in the SQL query in the handler file (primarily because the fields() member is being invoked on the query object) and can be resolved by adding a table alias (e.g. 'i') like so:
$result = db_select('aggregator_item', 'i')
->condition('iid', $this->value, 'IN')
->fields('i', array('title'))
->execute();
Comments
#1
This issue seems to be fixable. It would be really great if you could create a real patch, so it's much easier to realize what you try to do.
#2
Also a way to reproduce the problem would be really handy
#3
#4
Easily reproduced this issue.
See the two attached screenshots.
Contextual Filter Settings:
WHEN THE FILTER VALUE IS NOT IN THE URL:
Display all results for the specified field
#5
Here is a patch for it, so it would be cool if you could try it out.
#6
@dawehner Thank you. Tested and it works!
#7
So this seems to be RTBC.
#8
Thanks for testing the patch! Committed and pushed to 7.x-3.x