FoundationDB/sql-layer — pull request #1065 by MMcM (2013-11-20 22:58:12+00:00)
Title: Set parameter values max length

If it only comes from the other rows, it can cause truncation. See new test, which fails before this branch.

The right way for parameters to work is that type inference does bottom-up from non-params and then top-down for params and nulls. So, in the test case here, the length in the parameter's type would be that of the column against which it is being compared, 16. But that was too ambitious for the original implementation of OverloadAndTInstanceResolver and is too big for a fix now. It may warrant revisiting, since outside of MySQL parameters are much more common.

Integer.MAX_VALUE may be too big, if anything takes this to indicate an actual size. Would 65535 or thereabouts be a better choice?