I'm getting the following error when running the module using a Postgres database:
PDOException: SQLSTATE[42883]: Undefined function: 7 ERROR: operator does not exist: ! boolean LINE 4: WHERE (fde.entity_id IN ('1')) AND (!(fde.endpoints_entity... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.: SELECT fde.endpoints_entity_id AS endpoints_entity_id, fde.endpoints_entity_type AS endpoints_entity_type, fde.endpoints_r_index AS endpoints_r_index, fde.entity_id AS entity_id, fde.revision_id AS revision_id FROM {field_data_endpoints} fde WHERE (fde.entity_id IN (:db_condition_placeholder_0)) AND (!(fde.endpoints_entity_type = :entity_type AND fde.endpoints_entity_id = :entity_id)) ; Array ( [:db_condition_placeholder_0] => 1 [:entity_type] => node [:entity_id] => 65 ) in relation_select_entity_get_relations() (line 786 of /var/www/aegir/platforms/drupal-7.14/sites/all/modules/relation_select/relation_select.module).

This comes from line 781 of relation_select.module
$query->where('!(fde.endpoints_entity_type = :entity_type AND fde.endpoints_entity_id = :entity_id)' ...

For Postgres if this reads as follows (using NOT instead of !):-
$query->where('NOT(fde.endpoints_entity_type = :entity_type AND fde.endpoints_entity_id = :entity_id)' ...

The query runs. Thanks for the module btw, and apologies for not trying in mysql - I don't have an instance of it here.

Comments

Jeffrey04’s picture

thanks for the workaround to the problem :)

Gaelan’s picture

This problem exists on SQLite as well, with a similar error:

PDOException: SQLSTATE[HY000]: General error: 1 unrecognized token: "!(": SELECT fde.endpoints_entity_id AS endpoints_entity_id, fde.endpoints_entity_type AS endpoints_entity_type, fde.endpoints_r_index AS endpoints_r_index, fde.entity_id AS entity_id, fde.revision_id AS revision_id FROM {field_data_endpoints} fde WHERE (fde.entity_id IN (:db_condition_placeholder_0)) AND (!(fde.endpoints_entity_type = :entity_type AND fde.endpoints_entity_id = :entity_id)) ; Array ( [:db_condition_placeholder_0] => 3 [:entity_type] => node [:entity_id] => 1 ) in relation_select_entity_get_relations() (line 839 of /Users/Gaelan/Documents/Code/Portfolio/sites/all/modules/relation_select/relation_select.module).
Gaelan’s picture

Status: Active » Needs review
StatusFileSize
new638 bytes

Here's a patch.

Note: I did not find the bug, or fix it. I simply discovered that the bug also exists on SQLite, and created a patch out of the existing fix.

Gaelan’s picture

Title: Query exception for Postgresql in relation_select_entity_get_relations » Query exception for PostgreSQL and MySQL in relation_select_entity_get_relations
dlu’s picture

Priority: Normal » Major

I tried this out with MariaDB and it appears to work correctly.

Changed priority to Major because this bug keeps the module from being usable.