syntax error when using proximity filter in view with Postgres back end

ccurvey - February 6, 2009 - 19:33
Project:Location
Version:6.x-3.0
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

if you try to use the proximity filter in a view with a Postgres back end, you'll get the following errors when you try to update the filters

    * warning: pg_query() [function.pg-query]: Query failed: ERROR: argument of WHERE must be type boolean, not type integer in /home/chris/vijay/includes/database.pgsql.inc on line 139.
    * user warning: query: SELECT COUNT(*) FROM (SELECT node.nid AS nid FROM node node LEFT JOIN content_type_profile node_data_field_avatar ON node.vid = node_data_field_avatar.vid WHERE 0 ) count_alias in /home/chris/vijay/sites/all/modules/views/includes/view.inc on line 699.
    * warning: pg_query() [function.pg-query]: Query failed: ERROR: argument of WHERE must be type boolean, not type integer in /home/chris/vijay/includes/database.pgsql.inc on line 139.
    * user warning: query: SELECT node.nid AS nid, node_data_field_avatar.field_avatar_fid AS node_data_field_avatar_field_avatar_fid, node_data_field_avatar.field_avatar_list AS node_data_field_avatar_field_avatar_list, node_data_field_avatar.field_avatar_data AS node_data_field_avatar_field_avatar_data, node_data_field_avatar.nid AS node_data_field_avatar_nid, node.type AS node_type FROM node node LEFT JOIN content_type_profile node_data_field_avatar ON node.vid = node_data_field_avatar.vid WHERE 0 LIMIT 10 OFFSET 0 in /home/chris/vijay/sites/all/modules/views/includes/view.inc on line 725.

the problem where is the "WHERE 0". If you want to enforce a "false" value here, use "1 = 2" (or "1=1" if you're trying to emulate "true"...my MySQL brain cell has been lost).

#1

ositoblanco - November 4, 2009 - 16:19

Anny news on this? I have the same problem. I tried the approach 1 = 2 in location_views_handler_filter_proximity.inc line 201 (6.x-3.1-rc1). This brings an empty view without errors -- but also in the case where I have a distance of 100km and the zip code filter was equal to one of the nodes. So I'm not sure whats not working ... but something is working wrong.

 
 

Drupal is a registered trademark of Dries Buytaert.