equal
deleted
inserted
replaced
494 AND address = localpart |
494 AND address = localpart |
495 LOOP |
495 LOOP |
496 RETURN NEXT record; |
496 RETURN NEXT record; |
497 END LOOP; |
497 END LOOP; |
498 IF NOT FOUND THEN |
498 IF NOT FOUND THEN |
|
499 -- First, we have to check existing mailboxes and |
|
500 -- return identity if one exists |
499 FOR record IN |
501 FOR record IN |
500 SELECT recipient, destination |
502 SELECT recipient, recipient as destination |
501 FROM catchall |
503 FROM users |
502 WHERE gid = did |
504 WHERE gid = did |
|
505 AND local_part = localpart |
|
506 UNION SELECT recipient, recipient as destination |
|
507 FROM relocated |
|
508 WHERE gid = did |
|
509 AND address = localpart |
503 LOOP |
510 LOOP |
504 RETURN NEXT record; |
511 RETURN NEXT record; |
505 END LOOP; |
512 END LOOP; |
|
513 -- Only now can we think about catchalls... |
|
514 IF NOT FOUND THEN |
|
515 FOR record IN |
|
516 SELECT recipient, destination |
|
517 FROM catchall |
|
518 WHERE gid = did |
|
519 LOOP |
|
520 RETURN NEXT record; |
|
521 END LOOP; |
|
522 END IF; |
506 END IF; |
523 END IF; |
507 RETURN; |
524 RETURN; |
508 END; |
525 END; |
509 $$ LANGUAGE plpgsql STABLE |
526 $$ LANGUAGE plpgsql STABLE |
510 RETURNS NULL ON NULL INPUT |
527 RETURNS NULL ON NULL INPUT |