LP#1893463: Protect against null emails
authorMike Rylander <mrylander@gmail.com>
Mon, 12 Oct 2020 19:51:29 +0000 (15:51 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 22 Oct 2020 20:14:49 +0000 (16:14 -0400)
commit0dfb01195c80cd646b499f2fe2bada97f8e2f226
tree15fb6dd2c3b98a2d31bbe918b508ff522249c0bb
parentd5e8176421d87bd4197a9a1518f121973fd89704
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