Description
When using a very large interpolated statement, interpolateParams returns db.ErrSkip when the interpolated statement exceeds maxPacketAllowed. Inside database/sql, if ErrSkip is returned, Exec falls back to the prepare/execute cycle and returns any resultant error. Prepared statements have a limit of 65535 statements. Any error other than ErrSkip is returned immediately and no further prepare/execute is attempted.
I use interpolateParams to get statements larger than 65535 statements and to avoid the prepare/execute cycle. Returning ErrPktTooLarge allows users to either trim their packet size (drop the number of params to be interpolated) or to increase the max_allowed_packet inside mysql.
The current behavior is reasonable and acceptable because of the prepare/execute fallback. ErrPktTooLarge is also, in my opinion, reasonable and allows programs to self adjust or fix what they are doing.
Can it be an option to return ErrPktTooLarge?