1) Crash pgsql2shp -f x -u ws -P ws1234 results "select s1_main.prikey as prikey,s1_main._user as xuser,s1_main._version as xversion,s1_main._device as xdevice,to_char(s1_main._start, 'YYYY-MM-DD HH24:MI:SS') as xstart,to_char(s1_main._end, 'YYYY-MM-DD HH24:MI:SS') as xend,s1_main.name as name,s1_main.found as found,s1_main.street_number as street_number,s1_main.street_name as street_name,s1_main.suburb_town as suburb_town,s1_main.site_name as site_name,s1_main.location as location,s1_main.location_other as location_other,s1_main.incident as incident,s1_main.risk as risk,s1_main.risk_description as risk_description,s1_main.waste_bins as waste_bins,s1_main.recycling_bins as recycling_bins,s1_main.butt_bins as butt_bins,s1_main.bins__bins_overflowing as bins__bins_overflowing,s1_main.bins__bins_repair as bins__bins_repair,s1_main.bins__bins_signage as bins__bins_signage,s1_main.source__schools as source__schools,s1_main.source__retail as source__retail,s1_main.source__food_outlets as source__food_outlets,s1_main.source__tourist_site as source__tourist_site,s1_main.source__other as xsurceother,s1_main.green_waste as green_waste,s1_main.building_waste as building_waste,s1_main.soils_fill as soils_fill,s1_main.general_other as general_other,s1_main.asbestos as asbestos,s1_main.other_material as other_material,s1_main.mattresses as mattresses,s1_main.furniture as furniture,s1_main.whitegoods as whitegoods,s1_main.tyres as tyres,s1_main.ewaste as ewaste,s1_main.car_bodies as car_bodies,s1_main.evidence as evidence,s1_main.comments as comments,s1_main.investigation as investigation,s1_main.cleanup as cleanup,s1_main.cleanup_other as cleanup_other,s1_main.the_geom as the_geom from s1_main where s1_main._bad='false'" 2) Works fine pgsql2shp -f x -u ws -P ws1234 results "select s1_main.prikey as prikey,s1_main._user as xuser,s1_main._version as xversion,s1_main._device as xdevice,to_char(s1_main._start, 'YYYY-MM-DD HH24:MI:SS') as xstart,to_char(s1_main._end, 'YYYY-MM-DD HH24:MI:SS') as xend,s1_main.name as name,s1_main.found as found,s1_main.street_number as street_number,s1_main.street_name as street_name,s1_main.suburb_town as suburb_town,s1_main.site_name as site_name,s1_main.location as location,s1_main.location_other as location_other,s1_main.incident as incident,s1_main.risk as risk,s1_main.risk_description as risk_description,s1_main.waste_bins as waste_bins,s1_main.cleanup as cleanup,s1_main.cleanup_other as cleanup_other,s1_main.the_geom as the_geom from s1_main where s1_main._bad='false'"