· 8 years ago · Dec 19, 2017, 12:22 PM
1--
2-- PostgreSQL database cluster dump
3--
4
5SET default_transaction_read_only = off;
6
7SET client_encoding = 'SQL_ASCII';
8SET standard_conforming_strings = on;
9
10--
11-- Drop databases
12--
13
14DROP DATABASE lusiadas;
15DROP DATABASE test;
16
17
18
19
20--
21-- Drop roles
22--
23
24DROP ROLE postgres;
25DROP ROLE test;
26DROP ROLE ubuntu;
27DROP ROLE "user";
28
29
30--
31-- Roles
32--
33
34CREATE ROLE postgres;
35ALTER ROLE postgres WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN REPLICATION BYPASSRLS;
36CREATE ROLE test;
37ALTER ROLE test WITH SUPERUSER INHERIT NOCREATEROLE CREATEDB LOGIN NOREPLICATION NOBYPASSRLS;
38CREATE ROLE ubuntu;
39ALTER ROLE ubuntu WITH NOSUPERUSER INHERIT NOCREATEROLE CREATEDB LOGIN NOREPLICATION NOBYPASSRLS;
40CREATE ROLE "user";
41ALTER ROLE "user" WITH SUPERUSER INHERIT CREATEROLE CREATEDB LOGIN NOREPLICATION NOBYPASSRLS;
42
43
44
45
46
47
48--
49-- Database creation
50--
51
52CREATE DATABASE lusiadas WITH TEMPLATE = template0 OWNER = postgres;
53REVOKE ALL ON DATABASE template1 FROM PUBLIC;
54REVOKE ALL ON DATABASE template1 FROM postgres;
55GRANT ALL ON DATABASE template1 TO postgres;
56GRANT CONNECT ON DATABASE template1 TO PUBLIC;
57CREATE DATABASE test WITH TEMPLATE = template0 OWNER = postgres;
58
59
60\connect lusiadas
61
62SET default_transaction_read_only = off;
63
64--
65-- PostgreSQL database dump
66--
67
68-- Dumped from database version 9.5.10
69-- Dumped by pg_dump version 9.5.10
70
71SET statement_timeout = 0;
72SET lock_timeout = 0;
73SET client_encoding = 'SQL_ASCII';
74SET standard_conforming_strings = on;
75SET check_function_bodies = false;
76SET client_min_messages = warning;
77SET row_security = off;
78
79--
80-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
81--
82
83CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
84
85
86--
87-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
88--
89
90COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
91
92
93SET search_path = public, pg_catalog;
94
95SET default_tablespace = '';
96
97SET default_with_oids = false;
98
99--
100-- Name: films; Type: TABLE; Schema: public; Owner: postgres
101--
102
103CREATE TABLE films (
104 cod character(5),
105 title character varying(40)
106);
107
108
109ALTER TABLE films OWNER TO postgres;
110
111--
112-- Data for Name: films; Type: TABLE DATA; Schema: public; Owner: postgres
113--
114
115COPY films (cod, title) FROM stdin;
1161 first
1172 second
118\.
119
120
121--
122-- Name: production; Type: CONSTRAINT; Schema: public; Owner: postgres
123--
124
125ALTER TABLE ONLY films
126 ADD CONSTRAINT production UNIQUE (cod);
127
128
129--
130-- Name: public; Type: ACL; Schema: -; Owner: postgres
131--
132
133REVOKE ALL ON SCHEMA public FROM PUBLIC;
134REVOKE ALL ON SCHEMA public FROM postgres;
135GRANT ALL ON SCHEMA public TO postgres;
136GRANT ALL ON SCHEMA public TO PUBLIC;
137
138
139--
140-- PostgreSQL database dump complete
141--
142
143\connect postgres
144
145SET default_transaction_read_only = off;
146
147--
148-- PostgreSQL database dump
149--
150
151-- Dumped from database version 9.5.10
152-- Dumped by pg_dump version 9.5.10
153
154SET statement_timeout = 0;
155SET lock_timeout = 0;
156SET client_encoding = 'SQL_ASCII';
157SET standard_conforming_strings = on;
158SET check_function_bodies = false;
159SET client_min_messages = warning;
160SET row_security = off;
161
162--
163-- Name: postgres; Type: COMMENT; Schema: -; Owner: postgres
164--
165
166COMMENT ON DATABASE postgres IS 'default administrative connection database';
167
168
169--
170-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
171--
172
173CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
174
175
176--
177-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
178--
179
180COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
181
182
183--
184-- Name: public; Type: ACL; Schema: -; Owner: postgres
185--
186
187REVOKE ALL ON SCHEMA public FROM PUBLIC;
188REVOKE ALL ON SCHEMA public FROM postgres;
189GRANT ALL ON SCHEMA public TO postgres;
190GRANT ALL ON SCHEMA public TO PUBLIC;
191
192
193--
194-- PostgreSQL database dump complete
195--
196
197\connect template1
198
199SET default_transaction_read_only = off;
200
201--
202-- PostgreSQL database dump
203--
204
205-- Dumped from database version 9.5.10
206-- Dumped by pg_dump version 9.5.10
207
208SET statement_timeout = 0;
209SET lock_timeout = 0;
210SET client_encoding = 'SQL_ASCII';
211SET standard_conforming_strings = on;
212SET check_function_bodies = false;
213SET client_min_messages = warning;
214SET row_security = off;
215
216--
217-- Name: template1; Type: COMMENT; Schema: -; Owner: postgres
218--
219
220COMMENT ON DATABASE template1 IS 'default template for new databases';
221
222
223--
224-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
225--
226
227CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
228
229
230--
231-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
232--
233
234COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
235
236
237--
238-- Name: public; Type: ACL; Schema: -; Owner: postgres
239--
240
241REVOKE ALL ON SCHEMA public FROM PUBLIC;
242REVOKE ALL ON SCHEMA public FROM postgres;
243GRANT ALL ON SCHEMA public TO postgres;
244GRANT ALL ON SCHEMA public TO PUBLIC;
245
246
247--
248-- PostgreSQL database dump complete
249--
250
251\connect test
252
253SET default_transaction_read_only = off;
254
255--
256-- PostgreSQL database dump
257--
258
259-- Dumped from database version 9.5.10
260-- Dumped by pg_dump version 9.5.10
261
262SET statement_timeout = 0;
263SET lock_timeout = 0;
264SET client_encoding = 'SQL_ASCII';
265SET standard_conforming_strings = on;
266SET check_function_bodies = false;
267SET client_min_messages = warning;
268SET row_security = off;
269
270--
271-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner:
272--
273
274CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
275
276
277--
278-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner:
279--
280
281COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
282
283
284SET search_path = public, pg_catalog;
285
286SET default_tablespace = '';
287
288SET default_with_oids = false;
289
290--
291-- Name: testtable1; Type: TABLE; Schema: public; Owner: postgres
292--
293
294CREATE TABLE testtable1 (
295 id integer
296);
297
298
299ALTER TABLE testtable1 OWNER TO postgres;
300
301--
302-- Data for Name: testtable1; Type: TABLE DATA; Schema: public; Owner: postgres
303--
304
305COPY testtable1 (id) FROM stdin;
306\.
307
308
309--
310-- Name: public; Type: ACL; Schema: -; Owner: postgres
311--
312
313REVOKE ALL ON SCHEMA public FROM PUBLIC;
314REVOKE ALL ON SCHEMA public FROM postgres;
315GRANT ALL ON SCHEMA public TO postgres;
316GRANT ALL ON SCHEMA public TO PUBLIC;
317
318
319--
320-- PostgreSQL database dump complete
321--
322
323--
324-- PostgreSQL database cluster dump complete
325--