The SQLContentEntityStorage makes an equal assertment as an expression.

This does not work on all database engines. The database agnostic implementation is to use "CASE WHEN THEN ELSE END" construction.

$query->addExpression('base.' . $this->revisionKey . ' = revision.' . $this->revisionKey, 'isDefaultRevision');

This prevents any revisionable entity from being loaded, resulting in a PDO exception for database engines not supporting inline equal expressions.

Should be replaced with:

$query->addExpression('CASE base.' . $this->revisionKey . ' WHEN revision.' . $this->revisionKey . ' THEN 1 ELSE 0 END', 'isDefaultRevision');

Comments

david_garcia’s picture

Status: Needs work » Needs review
StatusFileSize
new818 bytes

I was not sure about the component system to assign this issue to... here goes the patch.

Status: Needs review » Needs work

The last submitted patch, 1: 2342377-inline-equal-expression.patch, failed testing.

david_garcia’s picture

Version: 8.1.x-dev » 8.0.0-alpha15
Status: Needs work » Needs review
david_garcia’s picture

StatusFileSize
new818 bytes

jhedstrom’s picture

Version: 8.0.0-alpha15 » 8.0.x-dev
Status: Needs review » Reviewed & tested by the community

Tests are still passing, patch applies. I've searched through core, and this appears to be the only instance where an inline equal expression is used.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 9f03518 and pushed to 8.0.x. Thanks!

  • alexpott committed 9f03518 on 8.0.x
    Issue #2342377 by david_garcia: Fixed Non database agnostic expression...

Status: Fixed » Closed (fixed)

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