These changes will make it easier to introduce tests for alternate databases that may have different results without the need to duplicate lots of the tests definition. Backport of 5873f10177ebda66d38e698218cf85dc6397e7d9 from main.