Bug: incorect row insert with phpunit temp tables

I wrote this unit test for a followup patch that does blob
encoding of the binary values.  It turned up an unrelated bug
that prevented inserting more than 2 levels deep in unit test
tables being doubled as temp tables in a unit test.

Patch adds a test and fixes the bug, which was a simple oversight
and made the query different than the one used in prod via
insertSelect

Change-Id: I106c905d56702541803c008e6d9fa8bd5f7c39ec