More PgSQL query fixes (still not complete)
More PgSQL query fixes (still not complete)

Mebus/Cachet,ephillipe/Cachet,sapk/Cachet,ZengineChris/Cachet,pellaeon/Cachet,whealmedia/Cachet,nxtreaming/Cachet,karaktaka/Cachet,karaktaka/Cachet,ZengineChris/Cachet,h3zjp/Cachet,CloudA/Cachet,MicroWorldwide/Cachet,eduardocruz/Cachet,chaseconey/Cachet,billmn/Cachet,0x73/Cachet,sapk/Cachet,bthiago/Cachet,elektropay/Cachet,0x73/Cachet,MatheusRV/Cachet-Sandstorm,Mebus/Cachet,NossaJureg/Cachet,chaseconey/Cachet,katzien/Cachet,pellaeon/Cachet,robglas/Cachet,g-forks/Cachet,SamuelMoraesF/Cachet,elektropay/Cachet,wngravette/Cachet,everpay/Cachet,MatheusRV/Cachet-Sandstorm,ephillipe/Cachet,rogerapras/Cachet,clbn/Cachet,billmn/Cachet,anujaprasad/Hihat,coupej/Cachet,cachethq/Cachet,murendie/Cachet,leegeng/Cachet,alobintechnologies/Cachet,h3zjp/Cachet,leegeng/Cachet,brianjking/openshift-cachet,murendie/Cachet,Surventrix/Cachet,withings-sas/Cachet,brianjking/openshift-cachet,bthiago/Cachet,clbn/Cachet,displayn/Cachet,wakermahmud/Cachet,g-forks/Cachet,n0mer/Cachet,withings-sas/Cachet,wakermahmud/Cachet,everpay/Cachet,coupej/Cachet,wngravette/Cachet,chaseconey/Cachet,katzien/Cachet,billmn/Cachet,ephillipe/Cachet,karaktaka/Cachet,NossaJureg/Cachet,g-forks/Cachet,MatheusRV/Cachet-Sandstorm,rogerapras/Cachet,h3zjp/Cachet,CloudA/Cachet,Mebus/Cachet,gm-ah/Cachet,eduardocruz/Cachet,Surventrix/Cachet,alobintechnologies/Cachet,cachethq/Cachet,ematthews/Cachet,pellaeon/Cachet,whealmedia/Cachet,coupej/Cachet,wakermahmud/Cachet,brianjking/openshift-cachet,MicroWorldwide/Cachet,sapk/Cachet,robglas/Cachet,withings-sas/Cachet,rogerapras/Cachet,SamuelMoraesF/Cachet,nxtreaming/Cachet,MatheusRV/Cachet-Sandstorm,displayn/Cachet,murendie/Cachet,SamuelMoraesF/Cachet,gm-ah/Cachet,anujaprasad/Hihat,ematthews/Cachet,MatheusRV/Cachet-Sandstorm,n0mer/Cachet,n0mer/Cachet,eduardocruz/Cachet,ematthews/Cachet,bthiago/Cachet,ZengineChris/Cachet,elektropay/Cachet,anujaprasad/Hihat,NossaJureg/Cachet