user warning

nickbits - October 16, 2009 - 09:47
Project:FeedAPI
Version:6.x-1.x-dev
Component:Code (general)
Category:bug report
Priority:critical
Assigned:Unassigned
Status:reviewed & tested by the community
Description

Hi All,

I have just upgraded my feedapi to the latest Dev one and now get the following error:

user warning: Unknown column 'Array.nid' in 'on clause' query: SELECT n.title, n.nid FROM node n INNER JOIN node_access na ON na.nid = Array.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'og_public'))) AND ( n.nid IN (0) )ORDER BY title DESC in /home/thatcham/public_html/sites/all/modules/feedapi/feedapi_node/feedapi_node.module on line 98.

I am using the latest OG module, version 2. Not sure what is causing it, have cleared the cache, etc. but still there.

Nick

#1

nickbits - October 16, 2009 - 10:00

Hi,

Just down graded to feedapi 6.x-1.8 and it works fine. so it would appear to be an issue with the latest dev release.

Nick

#2

Aron Novak - October 26, 2009 - 21:12
Status:active» needs review

Thanks for the bugreport, yeah, this issue is rather serious.
Can you test the attached patch?

AttachmentSize
606256_fix_db_rewrite_parentheses.patch 1.15 KB

#3

nickbits - October 29, 2009 - 21:21

Hi,

Thanks for that. Will test it as soon as I get a chance, with any luck Friday or Sat.

Nick

#4

Aron Novak - October 31, 2009 - 16:05
Status:needs review» fixed

Committed.

#5

imclean - November 11, 2009 - 00:45

This problem still exists in 6.x-1.9-beta3.

#6

aquanox24 - November 11, 2009 - 21:10

subscribe.
Patch File doesn't work

#7

imclean - November 11, 2009 - 21:55

It's a one line patch, it's pretty easy to change it yourself. Have a look at the patch file.

#8

markfoodyburton - November 12, 2009 - 08:49
Status:fixed» needs work

There is still a problem

With the patch (or the latest Beta), I get:
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(n.nid) FROM node n INNER JOIN node_access na ON na.nid = n.nid WHERE (' at line 1 query: SELECT n.title, DISTINCT(n.nid) FROM node n INNER JOIN node_access na ON na.nid = n.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'og_public') OR (na.gid = 25 AND na.realm = 'og_subscriber'))) AND ( n.nid IN (29) )ORDER BY title DESC

I suspect this is dependent upon: #284392: db_rewrite_sql causing issues with DISTINCT

Cheers

Mark

#9

markfoodyburton - November 12, 2009 - 13:23

MMm, that doesn't seem to change anything :-(

Not sure whats going on :-(

#10

markfoodyburton - November 12, 2009 - 13:36
Status:needs work» patch (to be ported)

Solved:

Index: feedapi_node/feedapi_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feedapi/feedapi_node/Attic/feedapi_node.module,v
retrieving revision 1.1.2.18.2.47
diff -r1.1.2.18.2.47 feedapi_node.module
98c98
< $result = db_query(db_rewrite_sql("SELECT n.title, n.nid FROM {node} n WHERE n.nid IN (". db_placeholders($node->feedapi_node->feed_nids, 'int') .") ORDER BY title DESC"), $node->feedapi_node->feed_nids);
---
> $result = db_query(db_rewrite_sql("SELECT n.nid, n.title FROM {node} n WHERE n.nid IN (". db_placeholders($node->feedapi_node->feed_nids, 'int') .") ORDER BY title DESC"), $node->feedapi_node->feed_nids);

you need the nid as the first element, so that it gets the 'distinct' clause round it.

Hope this helps

Cheers

Mark.

#11

Aron Novak - November 12, 2009 - 17:17
Status:patch (to be ported)» reviewed & tested by the community

This patch is fine, thank you Mark!

I attached this as a file. Can you confirm someone else that this helps?

I cannot understand at the moment how the order of the columns matter, but this does not matter here :) if it helps.

[ otherwise, it's a totally different problem as the initial post, the patch in #2 is really important also ]

AttachmentSize
606256_fix_rewrite.patch 1.17 KB

#12

bcobin - November 14, 2009 - 17:21

Neither patch worked for me, but I manually replaced the offending line and the problem seems to be solved!

Thanks much...

#13

stevensabatier - November 17, 2009 - 00:05

Hey, i just wanted to thank you Mark, i patched it and works great! Couldn't do this without ppl like you!

#14

markfoodyburton - November 17, 2009 - 18:29

:-)

#15

paulbooker - November 28, 2009 - 22:57

It worked like a charm.

 
 

Drupal is a registered trademark of Dries Buytaert.