pgsql/create_tables.pgsql
branchv0.6.x
changeset 550 867d950ce7b7
parent 549 44a808af6cf4
child 595 86b967c0f1a1
equal deleted inserted replaced
549:44a808af6cf4 550:867d950ce7b7
   547 AS $$
   547 AS $$
   548     DECLARE
   548     DECLARE
   549         record recipient_transport;
   549         record recipient_transport;
   550         recipient varchar(320) := localpart || '@' || the_domain;
   550         recipient varchar(320) := localpart || '@' || the_domain;
   551         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   551         did bigint := (SELECT gid FROM domain_name WHERE domainname = the_domain);
   552         transport_id bigint := (SELECT tid FROM users
   552         transport_id bigint;
   553                                   WHERE gid = did AND local_part = localpart);
   553     BEGIN
   554     BEGIN
   554         IF did IS NULL THEN
       
   555             RETURN;
       
   556         END IF;
       
   557 
       
   558         SELECT tid INTO transport_id
       
   559           FROM users
       
   560          WHERE gid = did AND local_part = localpart;
       
   561 
   555         IF transport_id IS NULL THEN
   562         IF transport_id IS NULL THEN
   556             SELECT tid INTO STRICT transport_id
   563             SELECT tid INTO STRICT transport_id
   557               FROM domain_data
   564               FROM domain_data
   558              WHERE gid = did;
   565              WHERE gid = did;
   559         END IF;
   566         END IF;