LP#1893463: Protect against null emails
authorMike Rylander <mrylander@gmail.com>
Mon, 12 Oct 2020 19:51:29 +0000 (15:51 -0400)
committerKyle Huckins <khuckins@catalyte.io>
Thu, 21 Jan 2021 20:38:36 +0000 (20:38 +0000)
commit1a4f38396173d9c4120d1f7fd9d86b8b09672539
tree9fe32b789999c0fb87f59f4cd4cfb9a7860b9535
parent7c9e94a8d6e463c835fd304fb24866ecd5cea6e4
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>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/sql/Pg/reporter-schema.sql
Open-ILS/src/sql/Pg/upgrade/1241.schema.reporter_schedule_uniqueness.sql