pgsql/create_tables-dovecot-1.2.x.pgsql
branchv0.6.x
changeset 550 867d950ce7b7
parent 549 44a808af6cf4
equal deleted inserted replaced
549:44a808af6cf4 550:867d950ce7b7
   569 AS $$
   569 AS $$
   570     DECLARE
   570     DECLARE
   571         record recipient_transport;
   571         record recipient_transport;
   572         recipient varchar(320) := localpart || '@' || the_domain;
   572         recipient varchar(320) := localpart || '@' || the_domain;
   573         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   573         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   574         transport_id bigint := (SELECT tid FROM users
   574         transport_id bigint;
   575                                   WHERE gid = did AND local_part = localpart);
   575     BEGIN
   576     BEGIN
   576         IF did IS NULL THEN
       
   577             RETURN;
       
   578         END IF;
       
   579 
       
   580         SELECT tid INTO transport_id
       
   581           FROM users
       
   582          WHERE gid = did AND local_part = localpart;
       
   583 
   577         IF transport_id IS NULL THEN
   584         IF transport_id IS NULL THEN
   578             SELECT tid INTO STRICT transport_id
   585             SELECT tid INTO STRICT transport_id
   579               FROM domain_data
   586               FROM domain_data
   580              WHERE gid = did;
   587              WHERE gid = did;
   581         END IF;
   588         END IF;