Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --
  2. -- PostgreSQL database dump
  3. --
  4.  
  5. -- Dumped from database version 9.5.14
  6. -- Dumped by pg_dump version 9.5.14
  7.  
  8. SET statement_timeout = 0;
  9. SET lock_timeout = 0;
  10. SET client_encoding = 'UTF8';
  11. SET standard_conforming_strings = on;
  12. SELECT pg_catalog.set_config('search_path', '', false);
  13. SET check_function_bodies = false;
  14. SET client_min_messages = warning;
  15. SET row_security = off;
  16.  
  17. --
  18. -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
  19. --
  20.  
  21. CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
  22.  
  23.  
  24. --
  25. -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
  26. --
  27.  
  28. COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  29.  
  30.  
  31. SET default_tablespace = '';
  32.  
  33. SET default_with_oids = false;
  34.  
  35. --
  36. -- Name: cars; Type: TABLE; Schema: public; Owner: postgres
  37. --
  38.  
  39. CREATE TABLE public.cars (
  40.     carid integer NOT NULL,
  41.     model character varying(30) NOT NULL,
  42.     ownerid integer NOT NULL,
  43.     color character varying(30)
  44. );
  45.  
  46.  
  47. ALTER TABLE public.cars OWNER TO postgres;
  48.  
  49. --
  50. -- Name: cars_carid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  51. --
  52.  
  53. CREATE SEQUENCE public.cars_carid_seq
  54.     START WITH 1
  55.     INCREMENT BY 1
  56.     NO MINVALUE
  57.     NO MAXVALUE
  58.     CACHE 1;
  59.  
  60.  
  61. ALTER TABLE public.cars_carid_seq OWNER TO postgres;
  62.  
  63. --
  64. -- Name: cars_carid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  65. --
  66.  
  67. ALTER SEQUENCE public.cars_carid_seq OWNED BY public.cars.carid;
  68.  
  69.  
  70. --
  71. -- Name: fines; Type: TABLE; Schema: public; Owner: postgres
  72. --
  73.  
  74. CREATE TABLE public.fines (
  75.     fid integer NOT NULL,
  76.     size integer NOT NULL,
  77.     placeid integer NOT NULL,
  78.     carid integer NOT NULL,
  79.     inspid integer NOT NULL,
  80.     driver_name character varying(30) NOT NULL,
  81.     car_model character varying(30) NOT NULL,
  82.     car_color character varying(30) NOT NULL,
  83.     inspector_name character varying(30) NOT NULL
  84. );
  85.  
  86.  
  87. ALTER TABLE public.fines OWNER TO postgres;
  88.  
  89. --
  90. -- Name: fines_fid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  91. --
  92.  
  93. CREATE SEQUENCE public.fines_fid_seq
  94.     START WITH 1
  95.     INCREMENT BY 1
  96.     NO MINVALUE
  97.     NO MAXVALUE
  98.     CACHE 1;
  99.  
  100.  
  101. ALTER TABLE public.fines_fid_seq OWNER TO postgres;
  102.  
  103. --
  104. -- Name: fines_fid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  105. --
  106.  
  107. ALTER SEQUENCE public.fines_fid_seq OWNED BY public.fines.fid;
  108.  
  109.  
  110. --
  111. -- Name: inspectors; Type: TABLE; Schema: public; Owner: postgres
  112. --
  113.  
  114. CREATE TABLE public.inspectors (
  115.     inspid integer NOT NULL,
  116.     inspname character varying(30) NOT NULL,
  117.     rank character varying(30) NOT NULL,
  118.     count_fines integer DEFAULT 0
  119. );
  120.  
  121.  
  122. ALTER TABLE public.inspectors OWNER TO postgres;
  123.  
  124. --
  125. -- Name: inspectors_inspid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  126. --
  127.  
  128. CREATE SEQUENCE public.inspectors_inspid_seq
  129.     START WITH 1
  130.     INCREMENT BY 1
  131.     NO MINVALUE
  132.     NO MAXVALUE
  133.     CACHE 1;
  134.  
  135.  
  136. ALTER TABLE public.inspectors_inspid_seq OWNER TO postgres;
  137.  
  138. --
  139. -- Name: inspectors_inspid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  140. --
  141.  
  142. ALTER SEQUENCE public.inspectors_inspid_seq OWNED BY public.inspectors.inspid;
  143.  
  144.  
  145. --
  146. -- Name: persons; Type: TABLE; Schema: public; Owner: postgres
  147. --
  148.  
  149. CREATE TABLE public.persons (
  150.     passport_number integer NOT NULL,
  151.     passport_series integer NOT NULL,
  152.     pname character varying(30) NOT NULL,
  153.     count_fines integer DEFAULT 0,
  154.     summ_fines integer DEFAULT 0
  155. );
  156.  
  157.  
  158. ALTER TABLE public.persons OWNER TO postgres;
  159.  
  160. --
  161. -- Name: places; Type: TABLE; Schema: public; Owner: postgres
  162. --
  163.  
  164. CREATE TABLE public.places (
  165.     placeid integer NOT NULL,
  166.     atype character varying(30) NOT NULL,
  167.     aname character varying(30) NOT NULL
  168. );
  169.  
  170.  
  171. ALTER TABLE public.places OWNER TO postgres;
  172.  
  173. --
  174. -- Name: places_placeid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
  175. --
  176.  
  177. CREATE SEQUENCE public.places_placeid_seq
  178.     START WITH 1
  179.     INCREMENT BY 1
  180.     NO MINVALUE
  181.     NO MAXVALUE
  182.     CACHE 1;
  183.  
  184.  
  185. ALTER TABLE public.places_placeid_seq OWNER TO postgres;
  186.  
  187. --
  188. -- Name: places_placeid_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
  189. --
  190.  
  191. ALTER SEQUENCE public.places_placeid_seq OWNED BY public.places.placeid;
  192.  
  193.  
  194. --
  195. -- Name: carid; Type: DEFAULT; Schema: public; Owner: postgres
  196. --
  197.  
  198. ALTER TABLE ONLY public.cars ALTER COLUMN carid SET DEFAULT nextval('public.cars_carid_seq'::regclass);
  199.  
  200.  
  201. --
  202. -- Name: fid; Type: DEFAULT; Schema: public; Owner: postgres
  203. --
  204.  
  205. ALTER TABLE ONLY public.fines ALTER COLUMN fid SET DEFAULT nextval('public.fines_fid_seq'::regclass);
  206.  
  207.  
  208. --
  209. -- Name: inspid; Type: DEFAULT; Schema: public; Owner: postgres
  210. --
  211.  
  212. ALTER TABLE ONLY public.inspectors ALTER COLUMN inspid SET DEFAULT nextval('public.inspectors_inspid_seq'::regclass);
  213.  
  214.  
  215. --
  216. -- Name: placeid; Type: DEFAULT; Schema: public; Owner: postgres
  217. --
  218.  
  219. ALTER TABLE ONLY public.places ALTER COLUMN placeid SET DEFAULT nextval('public.places_placeid_seq'::regclass);
  220.  
  221.  
  222. --
  223. -- Data for Name: cars; Type: TABLE DATA; Schema: public; Owner: postgres
  224. --
  225.  
  226. COPY public.cars (carid, model, ownerid, color) FROM stdin;
  227. \.
  228.  
  229.  
  230. --
  231. -- Name: cars_carid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
  232. --
  233.  
  234. SELECT pg_catalog.setval('public.cars_carid_seq', 1, false);
  235.  
  236.  
  237. --
  238. -- Data for Name: fines; Type: TABLE DATA; Schema: public; Owner: postgres
  239. --
  240.  
  241. COPY public.fines (fid, size, placeid, carid, inspid, driver_name, car_model, car_color, inspector_name) FROM stdin;
  242. \.
  243.  
  244.  
  245. --
  246. -- Name: fines_fid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
  247. --
  248.  
  249. SELECT pg_catalog.setval('public.fines_fid_seq', 1, false);
  250.  
  251.  
  252. --
  253. -- Data for Name: inspectors; Type: TABLE DATA; Schema: public; Owner: postgres
  254. --
  255.  
  256. COPY public.inspectors (inspid, inspname, rank, count_fines) FROM stdin;
  257. \.
  258.  
  259.  
  260. --
  261. -- Name: inspectors_inspid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
  262. --
  263.  
  264. SELECT pg_catalog.setval('public.inspectors_inspid_seq', 1, false);
  265.  
  266.  
  267. --
  268. -- Data for Name: persons; Type: TABLE DATA; Schema: public; Owner: postgres
  269. --
  270.  
  271. COPY public.persons (passport_number, passport_series, pname, count_fines, summ_fines) FROM stdin;
  272. \.
  273.  
  274.  
  275. --
  276. -- Data for Name: places; Type: TABLE DATA; Schema: public; Owner: postgres
  277. --
  278.  
  279. COPY public.places (placeid, atype, aname) FROM stdin;
  280. \.
  281.  
  282.  
  283. --
  284. -- Name: places_placeid_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
  285. --
  286.  
  287. SELECT pg_catalog.setval('public.places_placeid_seq', 1, false);
  288.  
  289.  
  290. --
  291. -- Name: cars_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  292. --
  293.  
  294. ALTER TABLE ONLY public.cars
  295.     ADD CONSTRAINT cars_pkey PRIMARY KEY (carid);
  296.  
  297.  
  298. --
  299. -- Name: fines_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  300. --
  301.  
  302. ALTER TABLE ONLY public.fines
  303.     ADD CONSTRAINT fines_pkey PRIMARY KEY (fid);
  304.  
  305.  
  306. --
  307. -- Name: inspectors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  308. --
  309.  
  310. ALTER TABLE ONLY public.inspectors
  311.     ADD CONSTRAINT inspectors_pkey PRIMARY KEY (inspid);
  312.  
  313.  
  314. --
  315. -- Name: persons_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  316. --
  317.  
  318. ALTER TABLE ONLY public.persons
  319.     ADD CONSTRAINT persons_pkey PRIMARY KEY (passport_number, passport_series);
  320.  
  321.  
  322. --
  323. -- Name: places_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
  324. --
  325.  
  326. ALTER TABLE ONLY public.places
  327.     ADD CONSTRAINT places_pkey PRIMARY KEY (placeid);
  328.  
  329.  
  330. --
  331. -- Name: fk; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  332. --
  333.  
  334. ALTER TABLE ONLY public.fines
  335.     ADD CONSTRAINT fk FOREIGN KEY (placeid) REFERENCES public.places(placeid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
  336.  
  337.  
  338. --
  339. -- Name: fk2; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  340. --
  341.  
  342. ALTER TABLE ONLY public.fines
  343.     ADD CONSTRAINT fk2 FOREIGN KEY (carid) REFERENCES public.cars(carid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
  344.  
  345.  
  346. --
  347. -- Name: fk3; Type: FK CONSTRAINT; Schema: public; Owner: postgres
  348. --
  349.  
  350. ALTER TABLE ONLY public.fines
  351.     ADD CONSTRAINT fk3 FOREIGN KEY (inspid) REFERENCES public.inspectors(inspid) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE;
  352.  
  353.  
  354. --
  355. -- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
  356. --
  357.  
  358. REVOKE ALL ON SCHEMA public FROM PUBLIC;
  359. REVOKE ALL ON SCHEMA public FROM postgres;
  360. GRANT ALL ON SCHEMA public TO postgres;
  361. GRANT ALL ON SCHEMA public TO PUBLIC;
  362.  
  363.  
  364. --
  365. -- PostgreSQL database dump complete
  366. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement