pgsql/update_tables_0.5.x-0.6-dovecot-1.2.x.pgsql
branchv0.6.x
changeset 550 867d950ce7b7
parent 549 44a808af6cf4
equal deleted inserted replaced
549:44a808af6cf4 550:867d950ce7b7
   494 AS $$
   494 AS $$
   495     DECLARE
   495     DECLARE
   496         record recipient_transport;
   496         record recipient_transport;
   497         recipient varchar(320) := localpart || '@' || the_domain;
   497         recipient varchar(320) := localpart || '@' || the_domain;
   498         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   498         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   499         transport_id bigint := (SELECT tid FROM users
   499         transport_id bigint;
   500                                   WHERE gid = did AND local_part = localpart);
   500     BEGIN
   501     BEGIN
   501         IF did IS NULL THEN
       
   502             RETURN;
       
   503         END IF;
       
   504 
       
   505         SELECT tid INTO transport_id
       
   506           FROM users
       
   507          WHERE gid = did AND local_part = localpart;
       
   508 
   502         IF transport_id IS NULL THEN
   509         IF transport_id IS NULL THEN
   503             SELECT tid INTO STRICT transport_id
   510             SELECT tid INTO STRICT transport_id
   504               FROM domain_data
   511               FROM domain_data
   505              WHERE gid = did;
   512              WHERE gid = did;
   506         END IF;
   513         END IF;