Fix some more boundary-case errors in psql variable substitution: wasn't really right for case where :var is at the end of the line, was definitely not right if var expanded to empty in that case, and failed to recalculate thislen before jumping back to rescan.
Fix some more boundary-case errors in psql variable substitution:
wasn't really right for case where :var is at the end of the line,
was definitely not right if var expanded to empty in that case,
and failed to recalculate thislen before jumping back to rescan.

yuanzhao/gpdb,greenplum-db/gpdb,lintzc/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,kaknikhil/gpdb,tangp3/gpdb,royc1/gpdb,adam8157/gpdb,chrishajas/gpdb,Quikling/gpdb,snaga/postgres-xl,atris/gpdb,yuanzhao/gpdb,Postgres-XL/Postgres-XL,ahachete/gpdb,greenplum-db/gpdb,janebeckman/gpdb,oberstet/postgres-xl,yuanzhao/gpdb,rubikloud/gpdb,jmcatamney/gpdb,edespino/gpdb,adam8157/gpdb,Postgres-XL/Postgres-XL,greenplum-db/gpdb,kaknikhil/gpdb,oberstet/postgres-xl,snaga/postgres-xl,ahachete/gpdb,zaksoup/gpdb,kaknikhil/gpdb,kmjungersen/PostgresXL,CraigHarris/gpdb,janebeckman/gpdb,randomtask1155/gpdb,kaknikhil/gpdb,atris/gpdb,jmcatamney/gpdb,kmjungersen/PostgresXL,edespino/gpdb,cjcjameson/gpdb,lintzc/gpdb,edespino/gpdb,chrishajas/gpdb,chrishajas/gpdb,zaksoup/gpdb,janebeckman/gpdb,tangp3/gpdb,ovr/postgres-xl,ahachete/gpdb,greenplum-db/gpdb,ashwinstar/gpdb,techdragon/Postgres-XL,kaknikhil/gpdb,rubikloud/gpdb,jmcatamney/gpdb,tangp3/gpdb,cjcjameson/gpdb,zaksoup/gpdb,oberstet/postgres-xl,adam8157/gpdb,ashwinstar/gpdb,yuanzhao/gpdb,lpetrov-pivotal/gpdb,royc1/gpdb,xinzweb/gpdb,janebeckman/gpdb,edespino/gpdb,foyzur/gpdb,Quikling/gpdb,foyzur/gpdb,adam8157/gpdb,janebeckman/gpdb,Chibin/gpdb,rvs/gpdb,rvs/gpdb,yazun/postgres-xl,arcivanov/postgres-xl,CraigHarris/gpdb,cjcjameson/gpdb,ahachete/gpdb,cjcjameson/gpdb,rubikloud/gpdb,edespino/gpdb,ashwinstar/gpdb,xinzweb/gpdb,tpostgres-projects/tPostgres,postmind-net/postgres-xl,50wu/gpdb,ahachete/gpdb,royc1/gpdb,adam8157/gpdb,royc1/gpdb,50wu/gpdb,tangp3/gpdb,postmind-net/postgres-xl,50wu/gpdb,chrishajas/gpdb,techdragon/Postgres-XL,0x0FFF/gpdb,randomtask1155/gpdb,50wu/gpdb,oberstet/postgres-xl,Quikling/gpdb,edespino/gpdb,oberstet/postgres-xl,tpostgres-projects/tPostgres,tpostgres-projects/tPostgres,randomtask1155/gpdb,zaksoup/gpdb,Chibin/gpdb,jmcatamney/gpdb,atris/gpdb,foyzur/gpdb,0x0FFF/gpdb,rvs/gpdb,rubikloud/gpdb,ashwinstar/gpdb,atris/gpdb,kmjungersen/PostgresXL,greenplum-db/gpdb,0x0FFF/gpdb,yazun/postgres-xl,xuegang/gpdb,xuegang/gpdb,atris/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,lpetrov-pivotal/gpdb,lpetrov-pivotal/gpdb,lisakowen/gpdb,yuanzhao/gpdb,pavanvd/postgres-xl,CraigHarris/gpdb,yuanzhao/gpdb,royc1/gpdb,lintzc/gpdb,xinzweb/gpdb,jmcatamney/gpdb,lpetrov-pivotal/gpdb,techdragon/Postgres-XL,ahachete/gpdb,randomtask1155/gpdb,zeroae/postgres-xl,50wu/gpdb,Quikling/gpdb,Chibin/gpdb,foyzur/gpdb,lintzc/gpdb,randomtask1155/gpdb,lisakowen/gpdb,xuegang/gpdb,chrishajas/gpdb,kaknikhil/gpdb,cjcjameson/gpdb,cjcjameson/gpdb,xuegang/gpdb,CraigHarris/gpdb,zaksoup/gpdb,tpostgres-projects/tPostgres,jmcatamney/gpdb,janebeckman/gpdb,xinzweb/gpdb,foyzur/gpdb,0x0FFF/gpdb,ashwinstar/gpdb,arcivanov/postgres-xl,pavanvd/postgres-xl,lpetrov-pivotal/gpdb,rvs/gpdb,rubikloud/gpdb,xuegang/gpdb,tangp3/gpdb,xinzweb/gpdb,adam8157/gpdb,arcivanov/postgres-xl,lisakowen/gpdb,xinzweb/gpdb,ashwinstar/gpdb,xinzweb/gpdb,zaksoup/gpdb,lpetrov-pivotal/gpdb,lintzc/gpdb,randomtask1155/gpdb,yuanzhao/gpdb,yazun/postgres-xl,Postgres-XL/Postgres-XL,Chibin/gpdb,snaga/postgres-xl,postmind-net/postgres-xl,lisakowen/gpdb,foyzur/gpdb,zeroae/postgres-xl,edespino/gpdb,rvs/gpdb,janebeckman/gpdb,kaknikhil/gpdb,rvs/gpdb,zaksoup/gpdb,greenplum-db/gpdb,rvs/gpdb,0x0FFF/gpdb,arcivanov/postgres-xl,rubikloud/gpdb,tpostgres-projects/tPostgres,foyzur/gpdb,0x0FFF/gpdb,royc1/gpdb,royc1/gpdb,pavanvd/postgres-xl,edespino/gpdb,adam8157/gpdb,CraigHarris/gpdb,arcivanov/postgres-xl,kaknikhil/gpdb,Quikling/gpdb,cjcjameson/gpdb,atris/gpdb,tangp3/gpdb,Chibin/gpdb,royc1/gpdb,janebeckman/gpdb,ovr/postgres-xl,lintzc/gpdb,zeroae/postgres-xl,xuegang/gpdb,lintzc/gpdb,lisakowen/gpdb,atris/gpdb,edespino/gpdb,techdragon/Postgres-XL,edespino/gpdb,CraigHarris/gpdb,zaksoup/gpdb,50wu/gpdb,Chibin/gpdb,chrishajas/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,xuegang/gpdb,lpetrov-pivotal/gpdb,lintzc/gpdb,lintzc/gpdb,snaga/postgres-xl,randomtask1155/gpdb,ovr/postgres-xl,50wu/gpdb,lisakowen/gpdb,Quikling/gpdb,postmind-net/postgres-xl,ovr/postgres-xl,xuegang/gpdb,jmcatamney/gpdb,yuanzhao/gpdb,snaga/postgres-xl,rvs/gpdb,rubikloud/gpdb,Postgres-XL/Postgres-XL,kmjungersen/PostgresXL,ahachete/gpdb,cjcjameson/gpdb,janebeckman/gpdb,xinzweb/gpdb,cjcjameson/gpdb,Chibin/gpdb,atris/gpdb,ahachete/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,postmind-net/postgres-xl,Chibin/gpdb,rvs/gpdb,0x0FFF/gpdb,chrishajas/gpdb,adam8157/gpdb,arcivanov/postgres-xl,zeroae/postgres-xl,CraigHarris/gpdb,50wu/gpdb,yazun/postgres-xl,lisakowen/gpdb,janebeckman/gpdb,tangp3/gpdb,ovr/postgres-xl,CraigHarris/gpdb,rvs/gpdb,kaknikhil/gpdb,zeroae/postgres-xl,ashwinstar/gpdb,yazun/postgres-xl,techdragon/Postgres-XL,tangp3/gpdb,pavanvd/postgres-xl,CraigHarris/gpdb,cjcjameson/gpdb,Chibin/gpdb,chrishajas/gpdb,Quikling/gpdb,0x0FFF/gpdb,lisakowen/gpdb,xuegang/gpdb,lpetrov-pivotal/gpdb,rubikloud/gpdb,foyzur/gpdb,Quikling/gpdb,pavanvd/postgres-xl,Chibin/gpdb,Postgres-XL/Postgres-XL,Quikling/gpdb,Quikling/gpdb