Clean up a number of bogosities around pltcl's handling of the Tcl "result":
Clean up a number of bogosities around pltcl's handling of the Tcl "result":

1. Directly reading interp->result is deprecated in Tcl 8.0 and later;
you're supposed to use Tcl_GetStringResult.  This code finally broke with
Tcl 8.5, because Tcl_GetVar can now have side-effects on interp->result even
though it preserves the logical state of the result.  (There's arguably a
Tcl issue here, because Tcl_GetVar could invalidate the pointer result of a
just-preceding Tcl_GetStringResult, but I doubt the Tcl guys will see it as
a bug.)

2. We were being sloppy about the encoding of the result: some places would
push database-encoding data into the Tcl result, which should not happen,
and we were assuming that any error result coming back from Tcl was in the
database encoding, which is not a good assumption.

3. There were a lot of calls of Tcl_SetResult that uselessly specified
TCL_VOLATILE for constant strings.  This is only a minor performance issue,
but I fixed it in passing since I had to look at all the calls anyway.

#2 is a live bug regardless of which Tcl version you are interested in,
so back-patch even to branches that are unlikely to be used with Tcl 8.5.
I went back as far as 8.0, which is as far as the patch applied easily;
7.4 was using a different error processing scheme that has got its own
problems :-(

yuanzhao/gpdb,0x0FFF/gpdb,edespino/gpdb,adam8157/gpdb,edespino/gpdb,chrishajas/gpdb,yuanzhao/gpdb,yuanzhao/gpdb,kaknikhil/gpdb,50wu/gpdb,cjcjameson/gpdb,lintzc/gpdb,adam8157/gpdb,zaksoup/gpdb,royc1/gpdb,ashwinstar/gpdb,Chibin/gpdb,edespino/gpdb,rvs/gpdb,lisakowen/gpdb,rvs/gpdb,zaksoup/gpdb,adam8157/gpdb,xuegang/gpdb,janebeckman/gpdb,cjcjameson/gpdb,lintzc/gpdb,lisakowen/gpdb,cjcjameson/gpdb,janebeckman/gpdb,0x0FFF/gpdb,zaksoup/gpdb,rvs/gpdb,Quikling/gpdb,lisakowen/gpdb,jmcatamney/gpdb,edespino/gpdb,edespino/gpdb,ashwinstar/gpdb,rvs/gpdb,royc1/gpdb,lintzc/gpdb,royc1/gpdb,royc1/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,rvs/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,royc1/gpdb,Quikling/gpdb,ahachete/gpdb,Chibin/gpdb,xinzweb/gpdb,rvs/gpdb,CraigHarris/gpdb,janebeckman/gpdb,ahachete/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,janebeckman/gpdb,lintzc/gpdb,xuegang/gpdb,greenplum-db/gpdb,Chibin/gpdb,ashwinstar/gpdb,xinzweb/gpdb,janebeckman/gpdb,xuegang/gpdb,xuegang/gpdb,0x0FFF/gpdb,yuanzhao/gpdb,royc1/gpdb,50wu/gpdb,xuegang/gpdb,0x0FFF/gpdb,zaksoup/gpdb,CraigHarris/gpdb,lintzc/gpdb,adam8157/gpdb,rvs/gpdb,lintzc/gpdb,CraigHarris/gpdb,lintzc/gpdb,Chibin/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,adam8157/gpdb,yuanzhao/gpdb,janebeckman/gpdb,yuanzhao/gpdb,ahachete/gpdb,xinzweb/gpdb,Chibin/gpdb,chrishajas/gpdb,CraigHarris/gpdb,CraigHarris/gpdb,zaksoup/gpdb,Chibin/gpdb,lisakowen/gpdb,ahachete/gpdb,yuanzhao/gpdb,xinzweb/gpdb,ashwinstar/gpdb,edespino/gpdb,xinzweb/gpdb,xinzweb/gpdb,xinzweb/gpdb,ahachete/gpdb,Chibin/gpdb,janebeckman/gpdb,chrishajas/gpdb,janebeckman/gpdb,ahachete/gpdb,ashwinstar/gpdb,lintzc/gpdb,yuanzhao/gpdb,zaksoup/gpdb,edespino/gpdb,greenplum-db/gpdb,50wu/gpdb,adam8157/gpdb,ahachete/gpdb,cjcjameson/gpdb,xuegang/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,0x0FFF/gpdb,edespino/gpdb,Quikling/gpdb,edespino/gpdb,0x0FFF/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,jmcatamney/gpdb,rvs/gpdb,Quikling/gpdb,zaksoup/gpdb,chrishajas/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,Quikling/gpdb,ahachete/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,kaknikhil/gpdb,Quikling/gpdb,Quikling/gpdb,chrishajas/gpdb,kaknikhil/gpdb,royc1/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,jmcatamney/gpdb,greenplum-db/gpdb,yuanzhao/gpdb,janebeckman/gpdb,xuegang/gpdb,cjcjameson/gpdb,50wu/gpdb,janebeckman/gpdb,Quikling/gpdb,edespino/gpdb,lisakowen/gpdb,jmcatamney/gpdb,xinzweb/gpdb,lisakowen/gpdb,adam8157/gpdb,50wu/gpdb,chrishajas/gpdb,Quikling/gpdb,kaknikhil/gpdb,kaknikhil/gpdb,50wu/gpdb,chrishajas/gpdb,adam8157/gpdb,CraigHarris/gpdb,rvs/gpdb,greenplum-db/gpdb,Chibin/gpdb,50wu/gpdb,Chibin/gpdb,chrishajas/gpdb,xuegang/gpdb,0x0FFF/gpdb,lisakowen/gpdb,CraigHarris/gpdb,ashwinstar/gpdb,0x0FFF/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,xuegang/gpdb,CraigHarris/gpdb,50wu/gpdb,kaknikhil/gpdb,Quikling/gpdb,lisakowen/gpdb,CraigHarris/gpdb,lintzc/gpdb,Chibin/gpdb,rvs/gpdb,royc1/gpdb,zaksoup/gpdb