[1.7.x] Avoided transactional truncates on amateur databases.

Fixed a test failure that appeared after 753a22a6, although the bug
existed before that commit.

Refs #22308.

Backport of 6877a9d4 from master