Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The following SQL error is experienced when the proximity filter is used through a view relation:
#1054 - Unknown column 'field_data_field_geolocation.field_geolocation_lat' in 'where clause'
After some investigation, it seems that the view's query does not use the table alias generated in the relation's JOIN, but the table name itself in the where condition, resulting in an error after executing the query.
Comment | File | Size | Author |
---|---|---|---|
#1 | geofield-sql-error-when-using-proximity-filter-through-view-relation-2153025-1.patch | 1.42 KB | ndobromirov |
Comments
Comment #1
ndobromirov CreditAttribution: ndobromirov commentedCreated a patch that solves the issue. It seems general enough to be committed, because nothing structural is changed.
Comment #2
Ayesh CreditAttribution: Ayesh commentedThanks for the patch!
Worked very well for me!
Comment #3
ndobromirov CreditAttribution: ndobromirov commentedThe code was tested by the community.
Change the issue status to RTBC.
Comment #4
ndobromirov CreditAttribution: ndobromirov commentedBump up priority to critical as this generates a fatal error.
Comment #6
Brandonian CreditAttribution: Brandonian commentedThanks for the patch, @ndobromirov! Committed to 7.x-2.x
http://drupalcode.org/project/geofield.git/commit/f43898e
Comment #8
stred CreditAttribution: stred commentedrelated to the issue #2221337: table name when using proximity contextual filter causes SQL error , for me it is the opposite that works.
on line 82: $table = $this->ensure_my_table() ? $this->table : $this->table_alias;
really do not understand why but if it can help someone else...
Comment #9
stred CreditAttribution: stred commentedHi had rewrited the query that's why the patch did not work as expected... Forget about my previous post, works like a charm, thank you!