I have noticed that the latex format in psql has some bugs:
I have noticed that the latex format in psql has some bugs:

o "_" is not escaped, and causes TeX to abort, thinking it's a
  subscript outside of maths mode.  Most of my table and field names
  use underscores, so this is a really nasty one.
o The column count is calculated using the contents of opt_align. But
  opt_align has one extra element, and so it's always one too many.  I
  changed it to count the column headings, like all the other output
  formats.  There may be a bug in computing opt_align that this patch
  does not address, but I'm not yet familiar enough with the psql
  source to fix this as well.
o  The line drawing rules for each border setting (0-3) and expanded
  mode didn't always match the documented behaviour and what other
  formats (e.g. aligned) did.  I made it as conformant as possible,
  and also tidied the alignment of the first line of the footer, which
  was incorrectly indented.

Roger Leigh

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