Fix a bug that can cause prepared statements with parameters to crash.
Because of custom plans, this does not manifest until the query has been executed several times in PostgreSQL 9.2 and higher.
Per report from Krzysztof Gorczyński.
This bug was introduced in 1.1.0.