 BEGIN
   --// PRE DELETE ROOM //--
   -- delete referenced building installation(s)
-  EXECUTE format('SELECT geodb_pkg.delete_building_inst(id, %L) FROM %I.building_installation WHERE room_id = %L', 
+  EXECUTE format('SELECT geodb_pkg.delete_building_installation(id, %L) FROM %I.building_installation WHERE room_id = %L', 
                     schema_name, schema_name, r_id);
 
   -- delete referenced thematic surfaces

/*
delete from BUILDING_INSTALLATION
*/
CREATE OR REPLACE FUNCTION geodb_pkg.delete_building_inst(
  bi_id INTEGER, 
  schema_name VARCHAR DEFAULT 'public'
  ) RETURNS SETOF VOID AS


  EXCEPTION
    WHEN OTHERS THEN
      RAISE NOTICE 'delete_building_installationallation (id: %): %', bi_id, SQLERRM;
END; 
$$ 
LANGUAGE plpgsql;
