equal
deleted
inserted
replaced
597 AND address = localpart |
597 AND address = localpart |
598 LOOP |
598 LOOP |
599 RETURN NEXT record; |
599 RETURN NEXT record; |
600 END LOOP; |
600 END LOOP; |
601 IF NOT FOUND THEN |
601 IF NOT FOUND THEN |
|
602 -- First, we have to check existing mailboxes and |
|
603 -- return identity if one exists |
602 FOR record IN |
604 FOR record IN |
603 SELECT recipient, destination |
605 SELECT recipient, recipient as destination |
604 FROM catchall |
606 FROM users |
605 WHERE gid = did |
607 WHERE gid = did |
|
608 AND local_part = localpart |
|
609 UNION SELECT recipient, recipient as destination |
|
610 FROM relocated |
|
611 WHERE gid = did |
|
612 AND address = localpart |
606 LOOP |
613 LOOP |
607 RETURN NEXT record; |
614 RETURN NEXT record; |
608 END LOOP; |
615 END LOOP; |
|
616 -- Only now can we think about catchalls... |
|
617 IF NOT FOUND THEN |
|
618 FOR record IN |
|
619 SELECT recipient, destination |
|
620 FROM catchall |
|
621 WHERE gid = did |
|
622 LOOP |
|
623 RETURN NEXT record; |
|
624 END LOOP; |
|
625 END IF; |
609 END IF; |
626 END IF; |
610 RETURN; |
627 RETURN; |
611 END; |
628 END; |
612 $$ LANGUAGE plpgsql STABLE |
629 $$ LANGUAGE plpgsql STABLE |
613 RETURNS NULL ON NULL INPUT |
630 RETURNS NULL ON NULL INPUT |