I have been having issues with feedapi this morning were 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 WHERE n.nid IN (5231) ORDER BY title DESC' at line 1 query: SELECT n.title, DISTINCT(n.nid) FROM node n WHERE n.nid IN (5231) ORDER BY title DESC in modules/feedapi/feedapi_node/feedapi_node.module on line 98.

showing on every feed node that's created. I am using feedapi_mapper to map feeds to nodes and I am not sure if that's related to this issue. Anyways, I am using latest drupal-6.14 and -dev modules.

Comments

likewhoa’s picture

just an added note the 5231 node is the feed node and thus this user warning is shown on every feed item page.

spangaroo’s picture

I'm also receiving the same error:

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 = 1 AND na.realm = 'workflow_access') OR (na.gid = 0 AND na.realm = 'workflow_access_owner'))) AND ( n.nid IN (2678) )ORDER BY title DESC in public_html/sites/all/modules/feedapi/feedapi_node/feedapi_node.module on line 98.

Mine mentions something about workflow_access but even if I disable the workflow module I still get the error in feedapi.

kostajh’s picture

Version: 6.x-1.x-dev » 6.x-1.9-beta3

Same problem here with 6.x-1.9-beta3.

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 WHERE n.nid IN (324) ORDER BY title DESC' at line 1 query: SELECT n.title, DISTINCT(n.nid) FROM node n WHERE n.nid IN (324) ORDER BY title DESC in /mysite/live-docs/sites/all/modules/feedapi/feedapi_node/feedapi_node.module on line 98.

I only got this error after enabling Content_Access and rebuilding content permissions on the site. If I disable and uninstall Content_Access, the errors go away.

Any thoughts?

Here is line 98 of the code:

$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);
khapin’s picture

Subscribe!
Same problem here, and I also use content_access.
I'll investigate some more next week...

khapin’s picture

I've applied the "patch" suggested in http://drupal.org/node/606256#comment-2257348 and it looks like it solved the problem. I don't really understand why it does though...

aron novak’s picture

Status: Active » Closed (duplicate)

#5: thanks khapin for trying it out, then this bug is the duplicate of
#606256: user warning

spangaroo’s picture

Great job, thank you.

Here's how I got it to work.

1. Backed up feedapi_node.module by changing its name to orig-feedapi_node.module

2. Downloaded the patch file located in http://drupal.org/node/606256#comment-2258088 (comment #11, 606256_fix_rewrite.patch)

3. Saved the file to /Applications/MAMP/htdocs/drupal/sites/all/modules/feedapi/

3. Opened the Terminal and navigated to /Applications/MAMP/htdocs/drupal/sites/all/modules/feedapi/

4. Applied the patch using this command: patch -p0 < 606256_fix_rewrite.patch

5. Received this message: "patching file feedapi_node/feedapi_node.module".

6. Uploaded the newly-patched version of feedapi_node.module to this directory on my webserver: /public_html/sites/all/modules/feedapi/feedapi_node/

8. Ran update.php and the user warning disappeared on all the /feed-item/[nid] pages.

9. Thanks again guys!