pgsql/create_tables.pgsql
branchv0.6.x
changeset 521 75d1c0d6bb8f
parent 518 5ec2068d02af
child 525 3acbff727626
--- 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;