pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
branchv0.6.x
changeset 521 75d1c0d6bb8f
parent 518 5ec2068d02af
child 525 3acbff727626
equal deleted inserted replaced
520:a0a27688e616 521:75d1c0d6bb8f
   507     DECLARE
   507     DECLARE
   508         recordc recipient_destination;
   508         recordc recipient_destination;
   509         record recipient_destination;
   509         record recipient_destination;
   510         catchall_cursor refcursor;
   510         catchall_cursor refcursor;
   511         recipient varchar(320) := localpart || '@' || the_domain;
   511         recipient varchar(320) := localpart || '@' || the_domain;
       
   512         idestination varchar(320) :=
       
   513             _interpolate_destination(destination, localpart, the_domain);
   512         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
   514         did bigint := (SELECT gid FROM domain_name WHERE domainname=the_domain);
   513     BEGIN
   515     BEGIN
   514         FOR record IN
   516         FOR record IN
   515             SELECT recipient,
   517             SELECT recipient, idestination
   516                 _interpolate_destination(destination, localpart, the_domain)
       
   517               FROM alias
   518               FROM alias
   518              WHERE gid = did
   519              WHERE gid = did
   519                AND address = localpart
   520                AND address = localpart
   520             LOOP
   521             LOOP
   521                 RETURN NEXT record;
   522                 RETURN NEXT record;
   529             -- over mailboxes/relocated, which is not what we want. Therefore,
   530             -- over mailboxes/relocated, which is not what we want. Therefore,
   530             -- we must first find out if the query is for an existing mailbox
   531             -- we must first find out if the query is for an existing mailbox
   531             -- or relocated entry and return the identity mapping if that is
   532             -- or relocated entry and return the identity mapping if that is
   532             -- the case
   533             -- the case
   533             OPEN catchall_cursor FOR
   534             OPEN catchall_cursor FOR
   534                 SELECT recipient,
   535                 SELECT recipient, idestination
   535                     _interpolate_destination(destination, localpart, the_domain)
       
   536                   FROM catchall
   536                   FROM catchall
   537                  WHERE gid = did;
   537                  WHERE gid = did;
   538             FETCH NEXT FROM catchall_cursor INTO recordc;
   538             FETCH NEXT FROM catchall_cursor INTO recordc;
   539 
   539 
   540             IF recordc IS NOT NULL THEN
   540             IF recordc IS NOT NULL THEN