While I was running some tests in psql, trying to figure out how to change
the query string to handle any length, I discovered that under certain
conditions, psql will core dump when handling long strings. Thus, the
patch. It was caused by a buffer overrun, probably not noticeable in a lot
of cases, but pretty noticeable in mine.
Problem was caused by the fact that the length check is only performed after
the check for a ; to get the end of the query and execute.