· 7 years ago · Jan 18, 2019, 10:02 AM
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
8SET statement_timeout = 0;
9SET lock_timeout = 0;
10SET client_encoding = 'UTF8';
11SET standard_conforming_strings = on;
12SELECT pg_catalog.set_config('search_path', '', false);
13SET check_function_bodies = false;
14SET client_min_messages = warning;
15SET row_security = off;
16
17--
18-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
19--
20
21CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
22
23
24--
25-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
26--
27
28COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
29
30
31SET default_tablespace = '';
32
33SET default_with_oids = false;
34
35--
36-- Name: cars; Type: TABLE; Schema: public; Owner: postgres
37--
38
39CREATE 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
47ALTER TABLE public.cars OWNER TO postgres;
48
49--
50-- Name: cars_carid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
51--
52
53CREATE SEQUENCE public.cars_carid_seq
54 START WITH 1
55 INCREMENT BY 1
56 NO MINVALUE
57 NO MAXVALUE
58 CACHE 1;
59
60
61ALTER 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
67ALTER SEQUENCE public.cars_carid_seq OWNED BY public.cars.carid;
68
69
70--
71-- Name: fines; Type: TABLE; Schema: public; Owner: postgres
72--
73
74CREATE 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
87ALTER TABLE public.fines OWNER TO postgres;
88
89--
90-- Name: fines_fid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
91--
92
93CREATE SEQUENCE public.fines_fid_seq
94 START WITH 1
95 INCREMENT BY 1
96 NO MINVALUE
97 NO MAXVALUE
98 CACHE 1;
99
100
101ALTER 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
107ALTER SEQUENCE public.fines_fid_seq OWNED BY public.fines.fid;
108
109
110--
111-- Name: inspectors; Type: TABLE; Schema: public; Owner: postgres
112--
113
114CREATE 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
122ALTER TABLE public.inspectors OWNER TO postgres;
123
124--
125-- Name: inspectors_inspid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
126--
127
128CREATE SEQUENCE public.inspectors_inspid_seq
129 START WITH 1
130 INCREMENT BY 1
131 NO MINVALUE
132 NO MAXVALUE
133 CACHE 1;
134
135
136ALTER 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
142ALTER SEQUENCE public.inspectors_inspid_seq OWNED BY public.inspectors.inspid;
143
144
145--
146-- Name: persons; Type: TABLE; Schema: public; Owner: postgres
147--
148
149CREATE 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
158ALTER TABLE public.persons OWNER TO postgres;
159
160--
161-- Name: places; Type: TABLE; Schema: public; Owner: postgres
162--
163
164CREATE 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
171ALTER TABLE public.places OWNER TO postgres;
172
173--
174-- Name: places_placeid_seq; Type: SEQUENCE; Schema: public; Owner: postgres
175--
176
177CREATE SEQUENCE public.places_placeid_seq
178 START WITH 1
179 INCREMENT BY 1
180 NO MINVALUE
181 NO MAXVALUE
182 CACHE 1;
183
184
185ALTER 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
191ALTER SEQUENCE public.places_placeid_seq OWNED BY public.places.placeid;
192
193
194--
195-- Name: carid; Type: DEFAULT; Schema: public; Owner: postgres
196--
197
198ALTER 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
205ALTER 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
212ALTER 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
219ALTER 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
226COPY 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
234SELECT 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
241COPY 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
249SELECT 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
256COPY 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
264SELECT 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
271COPY 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
279COPY 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
287SELECT pg_catalog.setval('public.places_placeid_seq', 1, false);
288
289
290--
291-- Name: cars_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
292--
293
294ALTER 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
302ALTER 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
310ALTER 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
318ALTER 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
326ALTER 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
334ALTER 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
342ALTER 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
350ALTER 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
358REVOKE ALL ON SCHEMA public FROM PUBLIC;
359REVOKE ALL ON SCHEMA public FROM postgres;
360GRANT ALL ON SCHEMA public TO postgres;
361GRANT ALL ON SCHEMA public TO PUBLIC;
362
363
364--
365-- PostgreSQL database dump complete
366--