Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- PostgreSQL database dump
- --
- -- Dumped from database version 9.5.14
- -- Dumped by pg_dump version 9.5.14
- SET statement_timeout = 0;
- SET lock_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 client_min_messages = warning;
- SET row_security = off;
- --
- -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
- --
- CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
- --
- -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
- --
- COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
- SET default_tablespace = '';
- SET default_with_oids = false;
- --
- -- Name: cars; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.cars (
- carid integer NOT NULL,
- model character varying(30) NOT NULL,
- ownerid integer NOT NULL,
- color character varying(30)
- );
- ALTER TABLE public.cars OWNER TO postgres;
- --
- -- Name: cars_carid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.cars_carid_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.cars_carid_seq OWNER TO postgres;
- --
- -- Name: cars_carid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.cars_carid_seq OWNED BY public.cars.carid;
- --
- -- Name: fines; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.fines (
- fid integer NOT NULL,
- size integer NOT NULL,
- placeid integer NOT NULL,
- carid integer NOT NULL,
- inspid integer NOT NULL,
- driver_name character varying(30) NOT NULL,
- car_model character varying(30) NOT NULL,
- car_color character varying(30) NOT NULL,
- inspector_name character varying(30) NOT NULL
- );
- ALTER TABLE public.fines OWNER TO postgres;
- --
- -- Name: fines_fid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.fines_fid_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.fines_fid_seq OWNER TO postgres;
- --
- -- Name: fines_fid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.fines_fid_seq OWNED BY public.fines.fid;
- --
- -- Name: inspectors; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.inspectors (
- inspid integer NOT NULL,
- inspname character varying(30) NOT NULL,
- rank character varying(30) NOT NULL,
- count_fines integer DEFAULT 0
- );
- ALTER TABLE public.inspectors OWNER TO postgres;
- --
- -- Name: inspectors_inspid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.inspectors_inspid_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.inspectors_inspid_seq OWNER TO postgres;
- --
- -- Name: inspectors_inspid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.inspectors_inspid_seq OWNED BY public.inspectors.inspid;
- --
- -- Name: persons; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.persons (
- passport_number integer NOT NULL,
- passport_series integer NOT NULL,
- pname character varying(30) NOT NULL,
- count_fines integer DEFAULT 0,
- summ_fines integer DEFAULT 0
- );
- ALTER TABLE public.persons OWNER TO postgres;
- --
- -- Name: places; Type: TABLE; Schema: public; Owner: postgres
- --
- CREATE TABLE public.places (
- placeid integer NOT NULL,
- atype character varying(30) NOT NULL,
- aname character varying(30) NOT NULL
- );
- ALTER TABLE public.places OWNER TO postgres;
- --
- -- Name: places_placeid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
- --
- CREATE SEQUENCE public.places_placeid_seq
- START WITH 1
- INCREMENT BY 1
- NO MINVALUE
- NO MAXVALUE
- CACHE 1;
- ALTER TABLE public.places_placeid_seq OWNER TO postgres;
- --
- -- Name: places_placeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
- --
- ALTER SEQUENCE public.places_placeid_seq OWNED BY public.places.placeid;
- --
- -- Name: carid; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.cars ALTER COLUMN carid SET DEFAULT nextval('public.cars_carid_seq'::regclass);
- --
- -- Name: fid; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.fines ALTER COLUMN fid SET DEFAULT nextval('public.fines_fid_seq'::regclass);
- --
- -- Name: inspid; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.inspectors ALTER COLUMN inspid SET DEFAULT nextval('public.inspectors_inspid_seq'::regclass);
- --
- -- Name: placeid; Type: DEFAULT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.places ALTER COLUMN placeid SET DEFAULT nextval('public.places_placeid_seq'::regclass);
- --
- -- Data for Name: cars; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY public.cars (carid, model, ownerid, color) FROM stdin;
- \.
- --
- -- Name: cars_carid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('public.cars_carid_seq', 1, false);
- --
- -- Data for Name: fines; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY public.fines (fid, size, placeid, carid, inspid, driver_name, car_model, car_color, inspector_name) FROM stdin;
- \.
- --
- -- Name: fines_fid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('public.fines_fid_seq', 1, false);
- --
- -- Data for Name: inspectors; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY public.inspectors (inspid, inspname, rank, count_fines) FROM stdin;
- \.
- --
- -- Name: inspectors_inspid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('public.inspectors_inspid_seq', 1, false);
- --
- -- Data for Name: persons; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY public.persons (passport_number, passport_series, pname, count_fines, summ_fines) FROM stdin;
- \.
- --
- -- Data for Name: places; Type: TABLE DATA; Schema: public; Owner: postgres
- --
- COPY public.places (placeid, atype, aname) FROM stdin;
- \.
- --
- -- Name: places_placeid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
- --
- SELECT pg_catalog.setval('public.places_placeid_seq', 1, false);
- --
- -- Name: cars_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.cars
- ADD CONSTRAINT cars_pkey PRIMARY KEY (carid);
- --
- -- Name: fines_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.fines
- ADD CONSTRAINT fines_pkey PRIMARY KEY (fid);
- --
- -- Name: inspectors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.inspectors
- ADD CONSTRAINT inspectors_pkey PRIMARY KEY (inspid);
- --
- -- Name: persons_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.persons
- ADD CONSTRAINT persons_pkey PRIMARY KEY (passport_number, passport_series);
- --
- -- Name: places_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.places
- ADD CONSTRAINT places_pkey PRIMARY KEY (placeid);
- --
- -- Name: fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.fines
- ADD CONSTRAINT fk FOREIGN KEY (placeid) REFERENCES public.places(placeid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
- --
- -- Name: fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.fines
- ADD CONSTRAINT fk2 FOREIGN KEY (carid) REFERENCES public.cars(carid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
- --
- -- Name: fk3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
- --
- ALTER TABLE ONLY public.fines
- ADD CONSTRAINT fk3 FOREIGN KEY (inspid) REFERENCES public.inspectors(inspid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
- --
- -- Name: SCHEMA 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;
- --
- -- PostgreSQL database dump complete
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement