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.
This issue is part of meta issue #1931088: [META] Fixing tests
This might be an issue for the Views issue queue, but I'm not really familiar enough with the issue to make that call.
Adding a relationship to a CCK Location field in Views 3.x generates the following error:
user warning: Unknown column 'node_data_field_location.lid' in 'on clause' query: SELECT DISTINCT location_node_data_field_location.lid AS location_node_data_field_location_lid FROM node node LEFT JOIN content_type_company node_data_field_location ON node.vid = node_data_field_location.vid LEFT JOIN location location_node_data_field_location ON node_data_field_location.lid = location_node_data_field_location.lid in /home/quickstart/websites/example.com/public_html/sites/all/modules/views/plugins/views_plugin_query_default.inc on line 1153.
Details:
CCK field is `field_location`
content type is `company`
I've tried to simplify the view as much as possible to shorted the SQL query and identify the issue. I'll continue and troubleshoot and add details. In the meantime, if anyone has a word of advice on the issue, any help would be appreciated.
Comment | File | Size | Author |
---|---|---|---|
#8 | Views3_incompatible_with_loc_cck-1291196-8.patch | 630 bytes | arcaneadam |
Comments
Comment #0.0
grasmash CreditAttribution: grasmash commentedchanging filepath
Comment #1
dawehnerThat's probably a location module issue.
Comment #2
ayalon CreditAttribution: ayalon commentedI have the same problem!
I updated to the latest views. The error occurs since the update.
Comment #3
emosbaugh CreditAttribution: emosbaugh commentedsame issue here
Comment #3.0
emosbaugh CreditAttribution: emosbaugh commentedwrapping in code tags
Comment #4
ayalon CreditAttribution: ayalon commentedI removed all Relationships with Location and added the fields without a relationship. This solved the problem.
Comment #5
grasmash CreditAttribution: grasmash commented@ayalon: That only works if you're only using a single CCK field.
If you're using two location CCK fields for different purposes, there is no way to specify which one the view should use for locational information. That presents a problem for any instance in which the Location CCK field needs to be specified, e.g, filters, sort criteria, arguments, or fields.
Comment #5.0
grasmash CreditAttribution: grasmash commentededit
Comment #6
pthornhi6 CreditAttribution: pthornhi6 commentedOk... I have this problem too.. I have it loading again. However, not in a way that will work systemically. I do want, however, to share what I have done just in case it helps.
I added the column lid to the content_field_location table. Then set the values in that column equal to the values in the lid column. Now everything is working again. I just can't do it this way because I don't believe the system will keep my column up to date.
Comment #7
cossme CreditAttribution: cossme commentedHi there,
I was having the same problem (using views-6.x.-3.0-rc1 and location-6.x.-3.x-dev Version of November 4th). As I understand this is caused by the location module not providing views with the correct information for the join defintions due to some changes in the views api.
Because my knowledge of the (updated) views api and the location module itself is rather poor I used a more or less quick and dirty hack to correct it (needed a solution fast). I used hook_views_query_alter to adjust the join definition for the location tables. In code this looks soemthing like this:
Not really beautiful but it works for now for me.
Cheers,
cossme
Comment #8
arcaneadam CreditAttribution: arcaneadam commentedThis patch should fix the issue. In the CCK definition it was telling views to use lid as the field as opposed to the field_alias
Comment #9
mattcasey CreditAttribution: mattcasey commented#8 works for me, using Location 3.x-dev and Views 3.0-rc2
Comment #10
AaronBaumanthank you, arcaneadam - so glad i didn't have to track this down myself.
#8 works for me, and it's a one-liner of a very obvious bug - let's get it in!
Comment #11
ankur CreditAttribution: ankur commentedDoes this patch break compatibility with 6.x-2.x?
If so, I'd like to figure out the best way to maintain compatibility with both views 6.x-2.x and views 6.x-3.x before committing this patch to location's 6.x-3.x branch.
Comment #12
arcaneadam CreditAttribution: arcaneadam commentedI don't think this is an issue with views. It's an issue more with how Location and CCk define the field with views. All it does is ensure that the DB field views is querying against is the correct field.
That being said. I agree it would be a good idea for someone to test vs. views 2 to ensure it still works.
Comment #13
ayalon CreditAttribution: ayalon commentedThe patch works flawlessly and should be commited soon. Using Views 3 is very common now.
Don't forget to flush the cache, because views schemas are cached.
Comment #14
GiorgosKThe patch works great with views 3
please commit
Comment #15
fehin CreditAttribution: fehin commented#8 patch worked for me too. Is there a reason it hasn't been committed yet?
Comment #16
djdevinWorks here as well. If there was a step higher than RTBC I'd mark it.
Comment #17
DarrellDuane CreditAttribution: DarrellDuane commentedRE #11, I hate to say it, but perhaps we need to make two versions of the Location module, one for views 2 and one for views 3 and create warning messages if they're out of sync.
#8 works for me with views-6.x-3.x
Comment #18
podarokpostponed before tests fix
#1931088: [META] Fixing tests
Comment #19
podarokpostponed before tests fix
#1931088: [META] Fixing tests
Comment #19.0
podarokremoved redundant link
Comment #20
podaroktests fixed #1931088: [META] Fixing tests
lets go
Comment #21
podarok#8 commited pushed to 6.x-3.x
thanks!
Comment #22.0
(not verified) CreditAttribution: commentedUpdated issue summary.