In .install code in function comment_notify_update_6004() there is small problem

1) Column notified is created with 'not null'=> TRUE
2) After creation, column is set to 1

Unfortunately, this translates into following Postgresql statements
1) Alter table add column - succeeds
2) alter table .. alter column set not null - FAIL because all values are null
3) update .. set notified=>1

So column should be created with DEFAULT 1 (and than changed to DEFAULT NULL) or upgrade code should add NOT NULL after initial value set.

CommentFileSizeAuthor
#3 comment-notify-1.2-install.diff948 bytesAlex_Tutubalin

Comments

greggles’s picture

Sounds good to me. Can you provide a patch and test it?

Alex_Tutubalin’s picture

There is another bug in module itself: INSERT without value for 'notified' field produces an error because of 'NOT NULL'

So, best solution is

1) Create notified field with default=>0
2) in comment_notify_update_6004 set all notified to 1 (already done in current code).

Alex_Tutubalin’s picture

StatusFileSize
new948 bytes

Here is the patch for .install file.

I think, it is better than patch module itself...

greggles’s picture

Status: Active » Needs work

Thanks for the patch!

We also need an update function to fix sites with this bad column and there appears to be a spacing issue.

Alex_Tutubalin’s picture

MySQL adds DEFAULT 0 setting for NOT NULL columns itself (I've asked some MySQL gurus). So, my changes means nothing for MySQL sites

On PgSQL sites .install simply does not works because DEFAULT value is not set and no value passed for notified column when table is filled.
So, there is no working sites with 'bad columns'.

greggles’s picture

Status: Needs work » Fixed

Alrighty then - fixed with some small code style cleanups along the way.

Status: Fixed » Closed (fixed)

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