 ) AS
 $func$
 BEGIN
+
 
 DROP TABLE IF EXISTS _odk_settlements;
 CREATE TABLE _odk_settlements AS

-- DELETE ACTUAL DUPES.. IE NOT REGIONS WITH SAME NAME WITH DIFF PARENT--
DELETE
FROM _odk_settlements
WHERE settlementname in
(
	SELECT
		settlementname
		--,count(*) AS C
	FROM _odk_settlements
	GROUP BY settlementname having count(*) > 1
);

DELETE
FROM _odk_settlements
WHERE REPLACE(settlementname,' ' ,'-') in
(
	SELECT
		REPLACE(settlementname,' ' ,'-')
		--,count(*) AS C
	FROM _odk_settlements
	GROUP BY REPLACE(settlementname,' ' ,'-') having count(*) > 1
);




RETURN QUERY

SELECT sr.id
FROM source_region sr
LIMIT 1;

