• The UNION approach is completely different from the other suggestions based on your initial requirement.

    The previous suggestions are constraining that a row in the referencing table should exist in the referenced ones, in both concurrently. The UNION approach will guarantee that it exists in at least one of the tables and not in both.

    Also, using the function will not guarantee that if you delete a row in any of the referenced tables then an existing row in the referencing table could become an orphan.