[Rt-commit] rt branch 4.4/pg-lower-cased-email-index created. rt-4.4.5-7-ge95c5bde65

BPS Git Server git at git.bestpractical.com
Fri Jan 21 15:33:34 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/pg-lower-cased-email-index has been created
        at  e95c5bde65bd732d5554fba5ba6ec5df090974df (commit)

- Log -----------------------------------------------------------------
commit e95c5bde65bd732d5554fba5ba6ec5df090974df
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 aa4b437e0a..0c31de6c68 100644
--- a/etc/schema.Pg
+++ b/etc/schema.Pg
@@ -383,7 +383,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.4.7/schema.Pg b/etc/upgrade/4.4.7/schema.Pg
new file mode 100644
index 0000000000..628b446a75
--- /dev/null
+++ b/etc/upgrade/4.4.7/schema.Pg
@@ -0,0 +1,2 @@
+DROP INDEX Users4;
+CREATE INDEX Users4 ON Users (LOWER(EmailAddress));

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list