Index: includes/handlers/geo_sql.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/handlers/geo_sql.inc,v
retrieving revision 1.10
diff -u -p -r1.10 geo_sql.inc
--- includes/handlers/geo_sql.inc	27 Apr 2010 02:18:22 -0000	1.10
+++ includes/handlers/geo_sql.inc	22 Oct 2010 13:16:45 -0000
@@ -20,6 +20,7 @@ class GeoSQL implements GeoInterface {
   protected $geo_type;
 
   protected $table_name;
+  protected $table_is_alias;
   protected $column_name;
   protected $schema;
   protected $indexed = GEO_UNKNOWN;
@@ -100,8 +101,8 @@ class GeoSQL implements GeoInterface {
   }
 
   function sqlTableAlias() {
-    if (($table = $this->tableName()) && ($column = $this->columnName())) {
-      return '{'. $table .'}.'. $column;
+    if (($table = $this->tableName(TRUE)) && ($column = $this->columnName())) {
+      return $table .'.'. $column;
     }
   }
 
@@ -350,12 +351,18 @@ class GeoSQL implements GeoInterface {
     return get_object_vars($this);
   }
 
-  function setTableName($value) {
+  function setTableName($value, $is_alias = FALSE) {
     $this->table_name = check_plain($value);
+    $this->table_is_alias = $is_alias;
   }
 
-  function tableName() {
-    return $this->table_name;
+  function tableName($prefix_tables = FALSE) {
+    if ($prefix_tables && !$this->table_is_alias && $this->table_name) {
+      return '{'. $this->table_name .'}';
+    }
+    else {
+      return $this->table_name;
+    }
   }
 
   function setColumnName($value) {
Index: includes/handlers/geo_sql_postgis.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/handlers/geo_sql_postgis.inc,v
retrieving revision 1.5
diff -u -p -r1.5 geo_sql_postgis.inc
--- includes/handlers/geo_sql_postgis.inc	10 Jun 2010 16:09:06 -0000	1.5
+++ includes/handlers/geo_sql_postgis.inc	22 Oct 2010 13:16:46 -0000
@@ -7,7 +7,7 @@ class GeoSQLPostGIS extends GeoSQL {
   private function postgisGeometryColumnInfo() {
     if (!isset($this->$geometry_columns_info)) {
       $res = db_query("SELECT * FROM geometry_columns
-        WHERE f_table_name = '{". $this->tableName() ."}'
+        WHERE f_table_name = '". $this->tableName(TRUE) ."'
         AND f_geometry_column = '%s'", $this->columnName());
       $this->geometry_columns_info = db_fetch_object($res);
     }
Index: includes/views/views_handler_field_geo.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/views/views_handler_field_geo.inc,v
retrieving revision 1.10
diff -u -p -r1.10 views_handler_field_geo.inc
--- includes/views/views_handler_field_geo.inc	26 Apr 2010 05:40:43 -0000	1.10
+++ includes/views/views_handler_field_geo.inc	22 Oct 2010 13:16:46 -0000
@@ -45,8 +45,7 @@ class views_handler_field_geo extends vi
       return;
     }
 
-    $table = $this->ensure_my_table();
-    $this->geo->setTableName($table);
+    $this->geo->setTableName($this->ensure_my_table(), TRUE);
     $this->geo->setColumnName($this->real_field);
 
     $alias = $this->real_field .'_'. strtolower($function);
Index: includes/views/views_handler_filter_geo.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/views/views_handler_filter_geo.inc,v
retrieving revision 1.17
diff -u -p -r1.17 views_handler_filter_geo.inc
--- includes/views/views_handler_filter_geo.inc	26 Jan 2010 23:19:09 -0000	1.17
+++ includes/views/views_handler_filter_geo.inc	22 Oct 2010 13:16:46 -0000
@@ -184,11 +184,10 @@ class views_handler_filter_geo extends v
     }
     $this->geo_target = $target;
 
-    $table = $this->ensure_my_table();
     $this->field_alias = $this->field .'_'. $function;
 
     // Ensure that the query acts on the table and column aliases defined here.
-    $this->geo->setTableName($table);
+    $this->geo->setTableName($this->ensure_my_table(), TRUE);
     $this->geo->setColumnName($this->field);
 
     // Get the Geo API method for adding a field.
Index: includes/views/views_handler_sort_geo.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/geo/includes/views/views_handler_sort_geo.inc,v
retrieving revision 1.3
diff -u -p -r1.3 views_handler_sort_geo.inc
--- includes/views/views_handler_sort_geo.inc	13 Jan 2010 18:29:46 -0000	1.3
+++ includes/views/views_handler_sort_geo.inc	22 Oct 2010 13:16:46 -0000
@@ -44,11 +44,10 @@ class views_handler_sort_geo extends vie
    
     // Otherwise, add and use the sort value.
     else {
-      $table = $this->ensure_my_table();
       $this->field_alias = $this->field .'_'. $function;
 
       // Ensure that the query acts on the table and column aliases defined here.
-      $this->geo->setTableName($table);
+      $this->geo->setTableName($this->ensure_my_table(), TRUE);
       $this->geo->setColumnName($this->field);
 
       // Add the field, using the Geo API method for getting it.
