[#3579] [#3664] Emulate nested set operators in databases that don't support them natively