Delete relations that become empty (#2270)