FoundationDB/sql-layer — pull request #1189 by MMcM (2014-01-30 02:15:30+00:00)
Title: Fix a number of problems with parameter types

* Add some assertions that the parameter lifecycle is being followed correctly.
* All parameters must be passed in the AST's parameter list, because the server will use that for decoding / meta-data.
* A parameter must have a type by the time that it is being assembled.
* A parameter should not look like a null (preptime type & value null) to the constant folder.

* Explicit CAST need to follow the same path as implicit in contributing to the parameter's type. This is because at the end, the nearest cast is taken as the parameter's own type and removed from the plan to represent the conversion that happens inside the cast expression.

* EXPLAIN and PREPARE, which allow parameters (which aren't supplied when they are executed), don't get them from the parser in the multiple statement case (those would be the params for *all* the statements, not just one of them). So walk the tree to find them to obey the above contract.

* Move default of VARCHAR(255) earlier to again obey the above.

See new tests for the reported problems fixed here.

Depends on #1188 and a parser branch.