--
-- PostgreSQL database dump
--

-- Dumped from database version 11.3
-- Dumped by pg_dump version 11.3

-- Started on 2019-06-18 12:00:48

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 4278 (class 1262 OID 622739)
-- Name: localdb; Type: DATABASE; Schema: -; Owner: postgres
--

CREATE DATABASE localdb WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252';


ALTER DATABASE localdb OWNER TO postgres;

\connect localdb

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 7 (class 2615 OID 624322)
-- Name: localdb; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA localdb;


ALTER SCHEMA localdb OWNER TO postgres;

--
-- TOC entry 3 (class 3079 OID 622740)
-- Name: postgis; Type: EXTENSION; Schema: -; Owner: 
--

CREATE EXTENSION IF NOT EXISTS postgis WITH SCHEMA public;


--
-- TOC entry 4279 (class 0 OID 0)
-- Dependencies: 3
-- Name: EXTENSION postgis; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION postgis IS 'PostGIS geometry, geography, and raster spatial types and functions';


--
-- TOC entry 2 (class 3079 OID 624318)
-- Name: postgres_fdw; Type: EXTENSION; Schema: -; Owner: 
--

CREATE EXTENSION IF NOT EXISTS postgres_fdw WITH SCHEMA public;


--
-- TOC entry 4280 (class 0 OID 0)
-- Dependencies: 2
-- Name: EXTENSION postgres_fdw; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION postgres_fdw IS 'foreign-data wrapper for remote PostgreSQL servers';


--
-- TOC entry 3105 (class 1417 OID 624323)
-- Name: remote; Type: SERVER; Schema: -; Owner: postgres
--

CREATE SERVER remote FOREIGN DATA WRAPPER postgres_fdw OPTIONS (
    dbname 'remote',
    extensions 'postgis,postgres_fdw',
    host 'localhost',
    port '5432'
);


ALTER SERVER remote OWNER TO postgres;

--
-- TOC entry 4281 (class 0 OID 0)
-- Dependencies: 3105
-- Name: USER MAPPING postgres SERVER remote; Type: USER MAPPING; Schema: -; Owner: postgres
--

CREATE USER MAPPING FOR postgres SERVER remote OPTIONS (
    password 'P@ssw0rd',
    "user" 'postgres'
);


SET default_tablespace = '';

--
-- TOC entry 214 (class 1259 OID 624325)
-- Name: locations; Type: FOREIGN TABLE; Schema: localdb; Owner: postgres
--

CREATE FOREIGN TABLE localdb.locations (
    id bigint NOT NULL,
    name character varying,
    lonlat public.geometry NOT NULL
)
SERVER remote
OPTIONS (
    schema_name 'remote',
    table_name 'locations'
);
ALTER FOREIGN TABLE localdb.locations ALTER COLUMN id OPTIONS (
    column_name 'id'
);
ALTER FOREIGN TABLE localdb.locations ALTER COLUMN name OPTIONS (
    column_name 'name'
);
ALTER FOREIGN TABLE localdb.locations ALTER COLUMN lonlat OPTIONS (
    column_name 'lonlat'
);


ALTER FOREIGN TABLE localdb.locations OWNER TO postgres;

--
-- TOC entry 4141 (class 0 OID 623049)
-- Dependencies: 200
-- Data for Name: spatial_ref_sys; Type: TABLE DATA; Schema: public; Owner: postgres
--



-- Completed on 2019-06-18 12:00:52

--
-- PostgreSQL database dump complete
--

