LP#1893463: Protect against null emails user/miker/lp1893462_upgrade_script_improvements_signoff
authorMike Rylander <mrylander@gmail.com>
Mon, 12 Oct 2020 19:51:29 +0000 (15:51 -0400)
committerMike Rylander <mrylander@gmail.com>
Mon, 12 Oct 2020 19:51:29 +0000 (15:51 -0400)
commit370117c67db7877de5521372946275d5de744a52
tree56cbd4eb4d46feeda894604a12f6efce79eabf83
parentb2d4681176039958b252906cf9ce3137bd41f9fe
LP#1893463: Protect against null emails

Unique indexes on nullable columns will allow multiple conceptually
unique rows if the nullable columns are, in fact, NULL because NULL does
not equal itself.  This commit uses COALESCE to make sure that the
nullable email column in the reporter.schedule table gets a value of the
empty string for the purposes of the unique index.  The upgrade script
now also takes this into account and ignores the email column.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/reporter-schema.sql
Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql