-- CREATE EXTENSION postgis;

CREATE DOMAIN my_timestamp AS timestamp;

CREATE TABLE _test_pos (
    id serial,
    pos geography(Point,4326)
);

CREATE TABLE _test_time (
    id integer,
    some_time my_timestamp
);

-- Don't automatically run ANALYZE
ALTER TABLE _test_pos SET (autovacuum_enabled = false, toast.autovacuum_enabled = false);
ALTER TABLE _test_time SET (autovacuum_enabled = false, toast.autovacuum_enabled = false);

-- Insert some dummy data

WITH rand AS
(
	SELECT generate_series(1, 20000)::float / 1000 AS x
)

INSERT INTO _test_pos(pos)
SELECT ST_MakePoint(x, x)::geography
FROM rand;

INSERT INTO _test_time (id, some_time)
SELECT id, '2012-05-04'::my_timestamp
FROM _test_pos;
