 							total AS pop_size,
 							total * pop_c / pop_y AS pop_curr,
 							lz_code,
-							'drought' AS lz_affected
+							'drought'::text AS lz_affected
 						FROM
 							zaf.demog_sas AS g,
 							zaf.tbl_pop_agegender_12y AS h,

					hh_size,
					lz_affected,
					wg_affected,
					CASE wg_affected WHEN 'grants' THEN 0.8 ELSE 0.2 AS pc_wg_affected,
					threshold,
					deficit
				FROM
					zaf.tbl_ofa_outcomes AS r,
					zaf.tbl_livezones_list AS s,
					(
						SELECT wg_name
						FROM zaf.tbl_wgs, zaf.tbl_wg_names
						WHERE zaf.tbl_wgs.wg_code = zaf.tbl_wg_names.tid
						) AS t
				WHERE
						r.lz_code = s.lz_code
					AND
						r.wg_code = t.wg_code
					AND

					total AS pop_size,
					total * pop_c / pop_y AS pop_curr,
					lz_code,
					'normal'::text AS lz_affected
				FROM
					(
						SELECT CAST(dc_mdb_code AS varchar(6)) AS dc_mdb_code, sum(pop) AS pop_c
