Flawed SQL statement warning when enabling the module
px - July 31, 2008 - 17:38
| Project: | Comment Subscribe |
| Version: | 6.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | zyxware |
| Status: | closed |
Jump to:
Description
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 'left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null' at line 2 query: insert into z_commentsubscribe (cid, parents, subscribe, subscribenode) left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null in ###Sorry, nonofficial project, can't disclose the path in my filesystem here###/htdocs/sites/all/modules/comment_subscribe/comment_subscribe.module on line 443.

#1
Yep, same error with both Drupal 6.3 and with 6.4
#2
I have the same problem:
* user warning: Table 'wwwfood_db.comments' doesn't exist query: select c1.cid, concat('0,', if(c1.pid <> 0, concat(c1.pid, ','),'') ) as parents from comments c1 in /arc/www/food/sites/all/modules/comment_subscribe/comment_subscribe.module on line 428.
* 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 'left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null' at line 2 query: insert into z_commentsubscribe (cid, parents, subscribe, subscribenode) left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null in /arc/www/food/sites/all/modules/comment_subscribe/comment_subscribe.module on line 443.
#3
Yes same in V5. I do not know if it will still work though...
#4
Hi I too have the same error! Any ideas? I want to use comment subscribe in a production server so am worried about data corruption with these SQL errors. Are they any substitutes to comment subscribe?
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 'left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null' at line 2 query: insert into z_commentsubscribe (cid, parents, subscribe, subscribenode) left join z_commentsubscribe cs on c1.cid = cs.cid where cs.subscribe is null in /home/sidk/public_html/change/public/includes/database.mysqli.inc on line 154.
#5
Fixed in my Postgresql patch (in MySQL mode too) http://drupal.org/node/319441
#6
The issue here is that the table names weren't bracketed and thus is doesn't work if the database setup has table prefixes:
i.e.
$sql = "select c1.cid, concat('0,', ".$ifcondition." ) as parents from comments c1 ".$join;
should be
$sql = "select c1.cid, concat('0,', ".$ifcondition." ) as parents from {comments} c1 ".$join;
(line 427 of version 6.x-1.1)
and
$join .= " join comments c".$level." on c".$prvlevel.".pid=c".$level.".cid";
should be
$join .= " join {comments} c".$level." on c".$prvlevel.".pid=c".$level.".cid";
(line 425 of version 6.x-1.1)
#7
Hi all,
The problem will be fixed in the next commit.
Thanks
zyxware
#8
Hi All,
The problem fixed in the latest dev release. Do check and inform us any bugs there?
Regards
zyxware
#9
The issue has been fixed in the latest release
#10
There's still an error left:
In comment_subscribe.isntall the line:
db_query("INSERT INTO z_nodesubscribe (nid, uid) select nid,uid from node");
should instead be:
db_query("INSERT INTO {z_nodesubscribe} (nid, uid) select nid,uid from {node}");
I think (i.e. my tables have prefixes and thus should be prefixed accordingly. I'm not sure that's the right syntax but afair it should.
#11
Changing status to active
#12
Fixed the issue in the latest commit
Regards
zyxware
#13
Automatically closed -- issue fixed for two weeks with no activity.
#14
I just downloaded version 6.x-1.2 and the bug still seems to be there.