[1.6.x] Fixed #21167 - Improved queries.tests.SubqueryTests

Improve tests to cover slicing scenarios that could be handled in unique
ways by 3rd party database backends.

Backport of b0e06c3662 from master