From 62a236952edadf8fa0d790ee82c2a0511e400b7d Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Sat, 10 Mar 2007 18:50:33 +0000 Subject: [PATCH] ERROR: null value in column "ar_deleted" violates not-null constraint in /var/www/html/wiki-pg/includes/DatabasePostgres.php on line 402 - coalesce NEW.ar_deleted in archive_insert rule, because MW might not specify it and the default doesn't take effect --- maintenance/postgres/archives/patch-archive2-ar_deleted.sql | 5 ++--- maintenance/postgres/tables.sql | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/maintenance/postgres/archives/patch-archive2-ar_deleted.sql b/maintenance/postgres/archives/patch-archive2-ar_deleted.sql index e05459ca45..3c59fd184c 100644 --- a/maintenance/postgres/archives/patch-archive2-ar_deleted.sql +++ b/maintenance/postgres/archives/patch-archive2-ar_deleted.sql @@ -12,7 +12,6 @@ CREATE RULE archive_insert AS ON INSERT TO archive DO INSTEAD INSERT INTO archive2 VALUES ( NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text, TO_TIMESTAMP(NEW.ar_timestamp, 'YYYYMMDDHH24MISS'), - NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id, NEW.ar_deleted + NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id, + COALESCE(NEW.ar_deleted, 0) -- ar_deleted is not always specified ); - - diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index 8777aa6198..10ca78f483 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -152,7 +152,8 @@ CREATE RULE archive_insert AS ON INSERT TO archive DO INSTEAD INSERT INTO archive2 VALUES ( NEW.ar_namespace, NEW.ar_title, NEW.ar_text, NEW.ar_comment, NEW.ar_user, NEW.ar_user_text, TO_TIMESTAMP(NEW.ar_timestamp, 'YYYYMMDDHH24MISS'), - NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id + NEW.ar_minor_edit, NEW.ar_flags, NEW.ar_rev_id, NEW.ar_text_id, + COALESCE(NEW.ar_deleted, 0) -- NEW.ar_deleted might be unspecified (NULL) ); CREATE RULE archive_delete AS ON DELETE TO archive -- 2.20.1