I am sorry I don't have any specific information, but I solved this problem by removing my table prefix on my site.

The behavior is that, in Views, Geo creates the query based on Drupal's table prefix, but view's alias does not use it. For example, this is the query you might get:

SELECT
 AsText(prefix_table_alias_name.field_alias)
FROM
 prefix_table_original AS table_alias_name

So, it throws an error because the value in the AsText is not correct. Again, this can be resolved by not using table prefixes, but this is not an actual solution.

CommentFileSizeAuthor
#1 geo-table-prefixes-776436.patch4.99 KBahtih

Comments

ahtih’s picture

Status: Active » Needs review
StatusFileSize
new4.99 KB

I ran into the same symptoms, and fixed it. Here is the patch against current CVS HEAD, works for me.

The problem was caused by GeoSQL->sql() always surrounding table names with {}, which made it impossible to correctly support aliased tables in a setup with table prefixes (in such a setup, real table names should be surrounded by {}, but aliases should not). In Views queries, all tables are aliased, so that's why the problem occurs with Views.

I fixed it by adding an "is_alias" parameter to GeoSQL->setTableName(), and "prefix_tables" parameter to GeoSQL->tableName(). Default values mimic old behaviour so as to not break any code. Views handlers set is_alias=TRUE so their table names do not get {} treatment.

ahtih’s picture

Title: Table prefix mismatch with Views » [PATCH] Table prefix mismatch with Views
amorsent’s picture

That patch seems to fix the problem for me.