Hi,

I am getting an error message when trying to activate the module (D7.10):

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'notify_hash' cannot be null: INSERT INTO {comment_notify} (cid, notify, notify_hash) SELECT c.cid AS cid, 0 AS notify, MD5(CONCAT(:salt, c.mail, COALESCE(u.mail, u.init), c.uid, c.name, c.nid, c.hostname, c.cid)) AS notify_hash FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid; Array ( [:salt] => 17381702364ee48560196473.46985816 ) in comment_notify_install() (line 28 of E:\xampp\htdocs\test\sites\all\modules\comment_notify\comment_notify.install).

Any idea how to solve this?
Thanks a lot in advance!

CommentFileSizeAuthor
#6 1367600-6-concat-null.patch914 byteskscheirer

Comments

greggles’s picture

Title: Error message on install: PDOException: SQLSTATE[23000]:.... » SQL error when installing on a site with comments: Column 'notify_hash' cannot be null

The issue seems to be related to adding this module to a site that already had comments and somehow the hash is empty. I'll try to test this out. The hash shouldn't be empty and in the error message it looks non-empty. Not sure what's going on there.

Golem07’s picture

Thanks a lot for the quick reply.
I do not know if this info helps. But I have just upgraded the site in question from D6.22 to 7.10. Comment notify has not been installed on the previous D6.22 version though.

OddJob’s picture

I have tried to replicate this using a few different stacks - dev desktop, uniform server, and tried upgrading the site from 6.x to 7.x

I followed the following:
http://drupal.org/node/570162
http://drupal.org/node/224333
http://drupalcode.org/project/drupal.git/blob/refs/heads/7.x:/UPGRADE.txt

I made sure I had some comments in place and that I did NOT have comment_notify installed.

I did the upgrade verified the site was working then installed comment_notify and enabled it.

I did not receive and error and the mail log seems to indicate that the notification is working.

@Golem07 could you specific the module sets and permissions/roles you where using when you experienced this?

At which point did you install the module and how? Manually? Drush? Where did you install the module too? sites/all/modules?

Did you enable it via the admin interface or Drush?

Any details you can provide would be great.

Hope I can help.

lazly’s picture

Version: 7.x-1.0 » 7.x-1.x-dev

I reproduce this problem, and the problem was that in my comment table there was few lines with 'null' value in the name and mail fields. So this bug is alive.

skin’s picture

Version: 7.x-1.x-dev » 7.x-1.1

Same problem for me, today I tried to install this module but with no luck: I have the same error reported by Golem07 .
I upgraded my site from D6 to D7, like Golem07 did.

Any help?

kscheirer’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Component: Miscellaneous » Code
Status: Active » Needs review
StatusFileSize
new914 bytes

Hmm, from the mysql doc on concat: "CONCAT() returns NULL if any argument is NULL." Which seems consistent with the reports above.

Concat_ws claims it will skip null arguments in the list of strings, the attached patch switches to using that. It's a bit of a hack to use the empty string '' as the separator. I'll leave to to greggles to decide if we should handle this another way, not sure what would cause those values to be NULL in the first place.

lazly’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

This patch is looks like fine, please make more test if you want, and commit it to -dev.

  • greggles committed c08d386 on 7.x-1.x authored by kscheirer
    Issue #1367600 by kscheirer: SQL error when installing on a site with...
greggles’s picture

Status: Reviewed & tested by the community » Fixed

A similar change was already done in 8.x, so I guess that's another vote for this idea.

Thanks for your help, kscheirer!

Status: Fixed » Closed (fixed)

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