CREATE OR REPLACE FUNCTION vrevisions.for_vrevisions_trunk_stable(sql text)
  RETURNS void AS
$BODY$
BEGIN
    SET search_path=vrevisions_trunk,public;
    EXECUTE sql;
    SET search_path=vrevisions_stable,public;
    EXECUTE sql;
END;
$BODY$
  LANGUAGE plpgsql;


SELECT vrevisions.for_vrevisions_trunk_stable('
CREATE INDEX IF NOT EXISTS objects_a7_zmax_index ON objects_a7 USING btree(zmax);
CREATE INDEX IF NOT EXISTS objects_a7_zmin_index ON objects_a7 USING btree(zmin);

CREATE INDEX IF NOT EXISTS objects_a7_the_geom_domain_service_attrs_idx ON objects_a7
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a7_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a8_zmax_index ON objects_a8 USING btree(zmax);
CREATE INDEX IF NOT EXISTS objects_a8_zmin_index ON objects_a8 USING btree(zmin);

CREATE INDEX IF NOT EXISTS objects_a8_the_geom_domain_service_attrs_idx ON objects_a8
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a8_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a10_the_geom_domain_service_attrs_idx ON objects_a10
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a10_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a12_the_geom_domain_service_attrs_idx ON objects_a12
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a12_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a14_the_geom_domain_service_attrs_idx ON objects_a14
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a14_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part0_the_geom_domain_service_attrs_idx ON objects_a16_part0
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part0_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part1_the_geom_domain_service_attrs_idx ON objects_a16_part1
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part1_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part2_the_geom_domain_service_attrs_idx ON objects_a16_part2
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part2_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part3_the_geom_domain_service_attrs_idx ON objects_a16_part3
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part3_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part4_the_geom_domain_service_attrs_idx ON objects_a16_part4
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part4_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part5_the_geom_domain_service_attrs_idx ON objects_a16_part5
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part5_the_geom_center_domain_service_attrs_idx;

CREATE INDEX IF NOT EXISTS objects_a16_part6_the_geom_domain_service_attrs_idx ON objects_a16_part6
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
DROP INDEX IF EXISTS objects_a16_part6_the_geom_center_domain_service_attrs_idx;


CREATE INDEX IF NOT EXISTS objects_p7_zmax_index ON objects_p7 USING btree(zmax);
CREATE INDEX IF NOT EXISTS objects_p7_zmin_index ON objects_p7 USING btree(zmin);

CREATE INDEX IF NOT EXISTS objects_p7_the_geom_domain_service_attrs_idx ON objects_p7
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p8_zmax_index ON objects_p8 USING btree(zmax);
CREATE INDEX IF NOT EXISTS objects_p8_zmin_index ON objects_p8 USING btree(zmin);

CREATE INDEX IF NOT EXISTS objects_p8_the_geom_domain_service_attrs_idx ON objects_p8
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p10_the_geom_domain_service_attrs_idx ON objects_p10
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p12_the_geom_domain_service_attrs_idx ON objects_p12
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p14_the_geom_domain_service_attrs_idx ON objects_p14
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part0_the_geom_domain_service_attrs_idx ON objects_p16_part0
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part1_the_geom_domain_service_attrs_idx ON objects_p16_part1
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part2_the_geom_domain_service_attrs_idx ON objects_p16_part2
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part3_the_geom_domain_service_attrs_idx ON objects_p16_part3
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part4_the_geom_domain_service_attrs_idx ON objects_p16_part4
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part5_the_geom_domain_service_attrs_idx ON objects_p16_part5
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_p16_part6_the_geom_domain_service_attrs_idx ON objects_p16_part6
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);


CREATE INDEX IF NOT EXISTS objects_l9_zmin_index ON objects_l9 USING btree(zmin);

CREATE INDEX IF NOT EXISTS objects_l9_the_geom_domain_service_attrs_idx ON objects_l9
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l10_the_geom_domain_service_attrs_idx ON objects_l10
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part0_the_geom_domain_service_attrs_idx ON objects_l12_part0
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part1_the_geom_domain_service_attrs_idx ON objects_l12_part1
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part2_the_geom_domain_service_attrs_idx ON objects_l12_part2
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part3_the_geom_domain_service_attrs_idx ON objects_l12_part3
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part4_the_geom_domain_service_attrs_idx ON objects_l12_part4
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part5_the_geom_domain_service_attrs_idx ON objects_l12_part5
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l12_part6_the_geom_domain_service_attrs_idx ON objects_l12_part6
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l15_part1_the_geom_domain_service_attrs_idx ON objects_l15_part1
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);

CREATE INDEX IF NOT EXISTS objects_l15_part2_the_geom_domain_service_attrs_idx ON objects_l15_part2
    USING gist (the_geom, domain_attrs, service_attrs) WITH (buffering=ON);
');
