Cache interpolated destination v0.6.x
authormartin f. krafft <madduck@madduck.net>
Fri, 13 Apr 2012 14:56:29 +0200
branchv0.6.x
changeset 521 75d1c0d6bb8f
parent 520 a0a27688e616
child 522 dc66f66c51cf
Cache interpolated destination Instead of running the string modification function for destination interpolation twice, store the result once and use the stored result subsequently.
pgsql/create_tables-dovecot-1.2.x.pgsql
pgsql/create_tables.pgsql
pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
pgsql/update_tables_0.5.x-0.6.pgsql
--- a/pgsql/create_tables-dovecot-1.2.x.pgsql	Thu Apr 12 18:22:54 2012 +0000
+++ b/pgsql/create_tables-dovecot-1.2.x.pgsql	Fri Apr 13 14:56:29 2012 +0200
@@ -612,11 +612,12 @@
         record recipient_destination;
         catchall_cursor refcursor;
         recipient varchar(320) := localpart || '@' || the_domain;
+        idestination varchar(320) :=
+            _interpolate_destination(destination, localpart, the_domain);
         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
     BEGIN
         FOR record IN
-            SELECT recipient,
-                _interpolate_destination(destination, localpart, the_domain)
+            SELECT recipient, idestination
               FROM alias
              WHERE gid = did
                AND address = localpart
@@ -634,8 +635,7 @@
             -- or relocated entry and return the identity mapping if that is
             -- the case
             OPEN catchall_cursor FOR
-                SELECT recipient,
-                    _interpolate_destination(destination, localpart, the_domain)
+                SELECT recipient, idestination
                   FROM catchall
                  WHERE gid = did;
             FETCH NEXT FROM catchall_cursor INTO recordc;
--- a/pgsql/create_tables.pgsql	Thu Apr 12 18:22:54 2012 +0000
+++ b/pgsql/create_tables.pgsql	Fri Apr 13 14:56:29 2012 +0200
@@ -589,11 +589,12 @@
         record recipient_destination;
         catchall_cursor refcursor;
         recipient varchar(320) := localpart || '@' || the_domain;
+        idestination varchar(320) :=
+            _interpolate_destination(destination, localpart, the_domain);
         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
     BEGIN
         FOR record IN
-            SELECT recipient,
-                _interpolate_destination(destination, localpart, the_domain)
+            SELECT recipient, idestination
               FROM alias
              WHERE gid = did
                AND address = localpart
@@ -611,8 +612,7 @@
             -- or relocated entry and return the identity mapping if that is
             -- the case
             OPEN catchall_cursor FOR
-                SELECT recipient,
-                    _interpolate_destination(destination, localpart, the_domain)
+                SELECT recipient, idestination
                   FROM catchall
                  WHERE gid = did;
             FETCH NEXT FROM catchall_cursor INTO recordc;
--- a/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Thu Apr 12 18:22:54 2012 +0000
+++ b/pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql	Fri Apr 13 14:56:29 2012 +0200
@@ -509,11 +509,12 @@
         record recipient_destination;
         catchall_cursor refcursor;
         recipient varchar(320) := localpart || '@' || the_domain;
+        idestination varchar(320) :=
+            _interpolate_destination(destination, localpart, the_domain);
         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
     BEGIN
         FOR record IN
-            SELECT recipient,
-                _interpolate_destination(destination, localpart, the_domain)
+            SELECT recipient, idestination
               FROM alias
              WHERE gid = did
                AND address = localpart
@@ -531,8 +532,7 @@
             -- or relocated entry and return the identity mapping if that is
             -- the case
             OPEN catchall_cursor FOR
-                SELECT recipient,
-                    _interpolate_destination(destination, localpart, the_domain)
+                SELECT recipient, idestination
                   FROM catchall
                  WHERE gid = did;
             FETCH NEXT FROM catchall_cursor INTO recordc;
--- a/pgsql/update_tables_0.5.x-0.6.pgsql	Thu Apr 12 18:22:54 2012 +0000
+++ b/pgsql/update_tables_0.5.x-0.6.pgsql	Fri Apr 13 14:56:29 2012 +0200
@@ -487,11 +487,12 @@
         record recipient_destination;
         catchall_cursor refcursor;
         recipient varchar(320) := localpart || '@' || the_domain;
+        idestination varchar(320) :=
+            _interpolate_destination(destination, localpart, the_domain);
         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
     BEGIN
         FOR record IN
-            SELECT recipient,
-                _interpolate_destination(destination, localpart, the_domain)
+            SELECT recipient, idestination
               FROM alias
              WHERE gid = did
                AND address = localpart
@@ -509,8 +510,7 @@
             -- or relocated entry and return the identity mapping if that is
             -- the case
             OPEN catchall_cursor FOR
-                SELECT recipient,
-                    _interpolate_destination(destination, localpart, the_domain)
+                SELECT recipient, idestination
                   FROM catchall
                  WHERE gid = did;
             FETCH NEXT FROM catchall_cursor INTO recordc;