This seems to be the same problem reported by mfm3 here under version 6.x-1.0. I'm getting similar errors on v5.x-1.1 but I'm on MySQL, and different modules are involved. This seems to be a standing problem in multiple releases of comment_subscribe. It seems to be related to a hook that gets triggered when another module (perhaps ANY other module?) modifies a comment.

My errors are generated when Akismet is used to modify a piece of spam (either marking it as ham or vice-versa). The error code is below. Note: Node 45034 was the last one that generated this error for me, and it has 59 comments:

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 ') AND subscribe=1) OR subscribenode=1 )AND c.status=0 AND LENGTH(IF(LENGTH(' at line 6 query: SELECT DISTINCT c.cid,u.init,c.uid,c.name,c.nid , IF(length(c.mail)<1, ifnull(u.mail,u.init), c.mail) mail FROM comments c LEFT OUTER JOIN users u ON u.uid=c.uid LEFT JOIN z_commentsubscribe zc on zc.cid=c.cid WHERE nid=45034 AND ((zc.cid IN () AND subscribe=1) OR subscribenode=1 )AND c.status=0 AND LENGTH(IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail))>1 AND IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) like '%@%.%' AND IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) <> '' GROUP BY IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) ORDER BY mail DESC in /home/imnotobsessed/imnotobsessed.com/public_html/includes/database.mysql.inc on line 172.

Here is an example of the defective query itself:

SELECT DISTINCT c.cid, u.init, c.uid, c.name, c.nid, IF( length( c.mail ) <1, ifnull( u.mail, u.init ) , c.mail ) mail
FROM comments c
LEFT OUTER JOIN users u ON u.uid = c.uid
LEFT JOIN z_commentsubscribe zc ON zc.cid = c.cid
WHERE nid =45034
AND (

(
zc.cid
IN (
)
AND subscribe =1
)
OR subscribenode =1
)
AND c.status =0
AND LENGTH( IF( LENGTH( c.mail ) <1, ifnull( u.mail, u.init ) , c.mail ) ) >1
AND IF( LENGTH( c.mail ) <1, ifnull( u.mail, u.init ) , c.mail ) LIKE '%@%.%'
AND IF( LENGTH( c.mail ) <1, ifnull( u.mail, u.init ) , c.mail ) <> ''
GROUP BY IF( LENGTH( c.mail ) <1, ifnull( u.mail, u.init ) , c.mail ) 
ORDER BY mail DESC 
LIMIT 0 , 30 

Right now I'm wondering if
zc.cid IN ( )
is the problem...

Comments

robertdouglass’s picture

Confirmed error on DRUPAL-5--1-1:

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 ') AND subscribe=1) OR subscribenode=1 )AND c.status=0 AND LENGTH(IF(LENGTH(c' at line 6 query: SELECT DISTINCT c.cid,u.init,c.uid,c.name,c.nid , IF(length(c.mail)<1, ifnull(u.mail,u.init), c.mail) mail FROM comments c LEFT OUTER JOIN users u ON u.uid=c.uid LEFT JOIN z_commentsubscribe zc on zc.cid=c.cid WHERE nid=0 AND ((zc.cid IN () AND subscribe=1) OR subscribenode=1 )AND c.status=0 AND LENGTH(IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail))>1 AND IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) like '%@%.%' AND IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) <> '' GROUP BY IF(LENGTH(c.mail)<1, ifnull(u.mail,u.init),c.mail) ORDER BY mail DESC in /var/www/rhd5/includes/database.mysql.inc on line 172.

The result is that no comments get sent.

zyxware’s picture

Assigned: Unassigned » zyxware
Status: Active » Fixed

Fixed issue in the new release

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

greggles’s picture

For those looking for an alternate solution, I suggest you look at comment_notify (which zyxware copied into this module) which has a completely rebuilt schema to avoid this problem and be postgresql compliant.