[Rt-commit] rt branch, 4.2/pg-lower-cased-email-index, created. rt-4.2.16-2-g3957e922bf
? sunnavy
sunnavy at bestpractical.com
Fri Jan 24 17:05:43 EST 2020
The branch, 4.2/pg-lower-cased-email-index has been created
at 3957e922bf8c863917713747ff46f00814e678f5 (commit)
- Log -----------------------------------------------------------------
commit 3957e922bf8c863917713747ff46f00814e678f5
Author: sunnavy <sunnavy at bestpractical.com>
Date: Sat Jan 25 05:50:08 2020 +0800
Update EmailAddress index to case insensitive for Pg
EmailAddress is case insensitive in RT(technically, name part could be
sensitive according to RFC, but it's confusing and rarely used in real
world). When we call RT::User::LoadByEmail, the WHERE part of generated
SQL in Pg is actually like:
LOWER(EmailAddress) = LOWER(?)
Thus we need to adjust index accordingly, which is also consistent with
the one in Oracle.
diff --git a/etc/schema.Pg b/etc/schema.Pg
index e5e2a04fe0..2bed4e04aa 100644
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -395,7 +395,7 @@ CREATE TABLE Users (
CREATE UNIQUE INDEX Users1 ON Users (LOWER(Name)) ;
-CREATE INDEX Users4 ON Users (EmailAddress);
+CREATE INDEX Users4 ON Users (LOWER(EmailAddress));
diff --git a/etc/upgrade/4.2.17/schema.Pg b/etc/upgrade/4.2.17/schema.Pg
new file mode 100644
index 0000000000..628b446a75
--- /dev/null
+++ b/etc/upgrade/4.2.17/schema.Pg
@@ -0,0 +1,2 @@
+DROP INDEX Users4;
+CREATE INDEX Users4 ON Users (LOWER(EmailAddress));
-----------------------------------------------------------------------
More information about the rt-commit
mailing list