problems with fused views that use the distinct field

christopher_skauss - January 25, 2007 - 02:35
Project:Views Fusion
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Hello!
I am receiving an SQL error when I create a fusioned view. The error is this

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(v4node.nid) AS v4node_nid, v4votingapi_cache.value AS v query: SELECT DISTINCT(node.nid), votingapi_cache.value AS votingapi_cache_value, DISTINCT(v4node.nid) AS v4node_nid, v4votingapi_cache.value AS v4v4votingapi_cache_value, v4node.title AS v4node_title, v4node.changed AS v4node_changed FROM node node LEFT JOIN votingapi_cache votingapi_cache ON node.nid = votingapi_cache.content_id AND votingapi_cache.content_type = 'node' LEFT JOIN nodefamily nodefamily ON node.nid = nodefamily.parent_nid LEFT JOIN node v4node ON nodefamily.child_nid = v4node.nid LEFT JOIN votingapi_cache v4votingapi_cache ON v4node.nid = v4votingapi_cache.content_id AND v4votingapi_cache.content_type = 'node' WHERE (votingapi_cache.function = 'average' OR votingapi_cache.function IS NULL) AND (node.type IN ('content_deal')) AND (votingapi_cache.func in F:\sites\test\includes\database.mysql.inc on line 121.

I am using drupal 4.7.5, views 1.4, fusion 1.0 and nodefamily 1.0
Thanks for your help!

#1

fago - January 27, 2007 - 20:30
Title:SQL error» views fusion has problems with fused views that use the distinct field

views fusion has troubles with views, that use the distinct parameter. Make sure that the fused view doesn't use the distinct field - but you can still set it for the primary view and it will affect the whole view.

but, there might be some custom fields that adds the distinct field to the view's query, but not as field. this fields can't also be used in the fused view!

#2

christopher_skauss - January 28, 2007 - 01:36

Thanks a lot! That did it!

#3

fago - February 16, 2007 - 14:10
Title:views fusion has problems with fused views that use the distinct field» problems with fused views that use the distinct field

I've written a views patch, which would allow us to fix the problem:
http://drupal.org/node/119742

Hopefully it goes in

#4

christopher_skauss - February 21, 2007 - 09:14

Great! I'll try it as soon as possible, thanks a lot!

#5

fago - March 5, 2007 - 12:57
Status:active» fixed

The patch has been applied to views :)
So I've fixed that in the latest views_fusion development snapshot. You'll also need the latest views snapshot.

#6

Operations - March 7, 2007 - 17:08
Version:4.7.x-1.0» 5.x-1.x-dev

was this path applied to the 5.x version too? i have the latest views_fusion for 5.x (march 6) and i get the same error when i try to use distinct... if not, do you have an ETA?

you wrote: "but, there might be some custom fields that adds the distinct field to the view's query, but not as field. this fields can't also be used in the fused view!"

could you explain this better?

#7

Operations - March 7, 2007 - 17:10
Status:fixed» active

forgot to reopen

#8

fago - March 7, 2007 - 18:01
Status:active» fixed

the quoted restriction is history. You have to use the latest views -dev snapshot too, and it will work. with 5.x too.

#9

Operations - March 7, 2007 - 20:00

i installed the most recent versions o views and views fusion, and i keep getting this error even if i dont use distinct...

#10

Operations - March 7, 2007 - 20:09
Status:fixed» active

forgot to reopen.... again... :)

#11

fago - March 7, 2007 - 20:13
Status:active» fixed

so then, it's no problem with distinct.
make sure that you 've run update.php, then edit each view that is part of the fusion and save it again. then try again.
Then:
if the problem persists please open another issue for your problem.

#12

Anonymous - March 21, 2007 - 20:15
Status:fixed» closed

#13

deadman - June 16, 2007 - 16:20
Status:closed» active

I'm still having this problem using the distinct filter. I've disabled all other filters created by other modules from the both views and tried all combinations of child - parent, parent - child, and fusing the views in both directions but i always get the error.

I am using views 1.6beta5 and the latest dev of views fusion on drupal 5.1

#14

fago - June 18, 2007 - 12:09

I also ran again over this problem - but this time it was caused by node access modules.

If node access modules are installed, drupal does query rewriting so that only the accessible nodes are returned. These query rewriting seems to cause troubles, when there is already a DISTINCT in the query. I've to investigate this issue a bit more...

So, are you also using a node access module?

#15

deadman - July 4, 2007 - 17:11

Yeah, I'm using organic groups so I guess that'll be the problem.

#16

mooffie - March 4, 2008 - 14:41

drupal does query rewriting [...]
These query rewriting seems to cause troubles

Yes, I can confirm that. The problem is in Drupal's db_distinct_field() and I've just proposed a patch:

http://drupal.org/node/229831

 
 

Drupal is a registered trademark of Dries Buytaert.