FoundationDB/sql-layer — pull request #942 by MMcM (2013-09-26 21:31:17+00:00)
Title: Issues with integer sizes in the binary Postgres encoding

These were uncovered testing performance with the pg8000 driver, which is one of the few that uses this encoding.

Bound integer parameters are sometimes sent with a size based on the value, not the declared type. See the inspect function in pg8000. This is harmless and easy to support, since parameter values have their own length field.

Information on the output type was not accurately updated when that type was changed due to overload resolution. This is just a matter of clearing the SQL type cache when the tInstance changes.

The second introduced some test expected results differences: the number of places in AVG of bigint_unsigned and the type of DIV. The second of these was a bug in the test. If test-div had been written to expect the correct result, based on its definition or MySQL's behavior, and not what it happened to send before, this bug would have been found earlier. And finally, JSON output types are now more often taken from the TInstance and not from the AIS. So, collation and character set names are canonical. And a CHAR column is VARCHAR in the JSON meta-data for the result. I did not make an effort to force through the AIS information, since the idea that calculation, even SELECT **, flattens the type space seemed defensible to me.