 -- cut parcels until there's no more land to cut
 DO $$
 DECLARE
-enough_land boolean;
-target_parcel_area float;
-poly_to_partition  integer;
+enough_land         boolean;
+target_parcel_area  float;
+poly_to_partition   integer;
 BEGIN
     poly_to_partition := 1;
     target_parcel_area := 8000.0;
     enough_land := true;
 
-    WHILE enough_land IS NOT NULL AND enough_land = true
+    WHILE enough_land IS NOT NULL
     LOOP
         RAISE NOTICE '----';
         enough_land := pseudo_parcel(poly_to_partition,target_parcel_area); 
     END LOOP;
 END$$;
+
 -- re-enable stdout output
 TRUNCATE support RESTART IDENTITY; 
 \o

-- as the first one was too complicated)
--
-- it only uses the boundary and the roads.
-- finds which of the four centroid quadrants, the closest 
-- road point belongs to.
--
CREATE OR REPLACE FUNCTION find_cut_corner2(boundary geometry[], poly geometry) RETURNS text AS $$

cut_corner  text;
-- the result of the inset split
inset_split geometry[];
inset_pos   float;
-- area of the input polygon
p_area      float;
-- cut line
cut_result  geometry[];
-- constants indicating which piece to select after the split
