Comment 6 for bug 1173440

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Okay, I see what's going on. The group.urlid column in the database has a uniqueness constraint on it. But, it's also NULLable, and even with a uniqueness constraint in place, it's okay to have multiple rows with NULL values.

But, the way the code's written, when you activate cleanurl mode, and then make changes to an old group that still doesn't have a urlid value yet, the code saves it as the empty string '' rather than as NULL. These are more or less identical on the PHP side of things, but on the database side the difference is important because '' DOES count towards uniqueness. So, when you go to edit a second group without a urlid, the code tries to set its urlid to '' as well, and dies because it violates that uniqueness constraint.

One workaround to this problem is to run the "regenerate clean URLs" script immediately after activating cleanurls. But, in the absence of that, this patch will at least avoid an error condition. :)

It's quite possible there may be the same issue for Users and Pages. I think no one has reported it yet because most sites run the "regenerate clean URLs" script.