Snippets

Bruno Ferreira SQL Dump to create a simple database to use as an example for the problem described at http://blog.brunoferreira.me/the-importance-of-reading-the-documentation/.

Created by Bruno Ferreira
--
-- PostgreSQL database dump
--

-- Dumped from database version 9.1.15
-- Dumped by pg_dump version 9.1.15
-- Started on 2015-06-16 23:08:51 WEST

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- TOC entry 163 (class 3079 OID 11687)
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- TOC entry 1911 (class 0 OID 0)
-- Dependencies: 163
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- TOC entry 162 (class 1259 OID 16417)
-- Dependencies: 5
-- Name: customer; Type: TABLE; Schema: public; Owner: admin; Tablespace: 
--

CREATE TABLE customer (
    store_id integer NOT NULL,
    id integer NOT NULL
);


ALTER TABLE public.customer OWNER TO admin;

--
-- TOC entry 161 (class 1259 OID 16397)
-- Dependencies: 1795 5
-- Name: store; Type: TABLE; Schema: public; Owner: admin; Tablespace: 
--

CREATE TABLE store (
    id integer NOT NULL,
    location character varying(50),
    active boolean DEFAULT true NOT NULL
);


ALTER TABLE public.store OWNER TO admin;

--
-- TOC entry 1903 (class 0 OID 16417)
-- Dependencies: 162 1904
-- Data for Name: customer; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY customer (store_id, id) FROM stdin;
1	1
\.


--
-- TOC entry 1902 (class 0 OID 16397)
-- Dependencies: 161 1904
-- Data for Name: store; Type: TABLE DATA; Schema: public; Owner: admin
--

COPY store (id, location, active) FROM stdin;
1	FNAX	t
\.


--
-- TOC entry 1799 (class 2606 OID 16421)
-- Dependencies: 162 162 1905
-- Name: pk; Type: CONSTRAINT; Schema: public; Owner: admin; Tablespace: 
--

ALTER TABLE ONLY customer
    ADD CONSTRAINT pk PRIMARY KEY (id);


--
-- TOC entry 1797 (class 2606 OID 16401)
-- Dependencies: 161 161 1905
-- Name: store_pkey; Type: CONSTRAINT; Schema: public; Owner: admin; Tablespace: 
--

ALTER TABLE ONLY store
    ADD CONSTRAINT store_pkey PRIMARY KEY (id);


--
-- TOC entry 1800 (class 2606 OID 16422)
-- Dependencies: 161 162 1796 1905
-- Name: store_fk; Type: FK CONSTRAINT; Schema: public; Owner: admin
--

ALTER TABLE ONLY customer
    ADD CONSTRAINT store_fk FOREIGN KEY (store_id) REFERENCES store(id);


--
-- TOC entry 1910 (class 0 OID 0)
-- Dependencies: 5
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


-- Completed on 2015-06-16 23:08:52 WEST

--
-- PostgreSQL database dump complete
--

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.