ALTER TABLE "mail_address"
    ADD FOREIGN KEY ("mailbox") REFERENCES "mail_box" ("id") ON DELETE RESTRICT ON
    UPDATE
        RESTRICT;

ALTER TABLE "mail_filter"
    ADD FOREIGN KEY ("mailbox") REFERENCES "mail_box" ("id") ON DELETE RESTRICT ON
    UPDATE
        RESTRICT;

ALTER TABLE "mail_filter_cond"
    ADD FOREIGN KEY ("filter") REFERENCES "mail_filter" ("id") ON DELETE RESTRICT ON
    UPDATE
        RESTRICT;

SELECT
    name
FROM
    skuska
WHERE
    activation <= now()
    AND (deactivation IS NULL
        OR deactivation > now());

