-
Notifications
You must be signed in to change notification settings - Fork 1
/
pg_nntp_schema.sql
558 lines (372 loc) · 12.7 KB
/
pg_nntp_schema.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
--
-- PostgreSQL database dump
--
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;
SET search_path = public, pg_catalog;
--
-- Name: gtrgm; Type: SHELL TYPE; Schema: public; Owner: nemik
--
CREATE TYPE gtrgm;
--
-- Name: gtrgm_in(cstring); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_in(cstring) RETURNS gtrgm
AS '$libdir/pg_trgm', 'gtrgm_in'
LANGUAGE c STRICT;
ALTER FUNCTION public.gtrgm_in(cstring) OWNER TO nemik;
--
-- Name: gtrgm_out(gtrgm); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_out(gtrgm) RETURNS cstring
AS '$libdir/pg_trgm', 'gtrgm_out'
LANGUAGE c STRICT;
ALTER FUNCTION public.gtrgm_out(gtrgm) OWNER TO nemik;
--
-- Name: gtrgm; Type: TYPE; Schema: public; Owner: nemik
--
CREATE TYPE gtrgm (
INTERNALLENGTH = variable,
INPUT = gtrgm_in,
OUTPUT = gtrgm_out,
ALIGNMENT = int4,
STORAGE = plain
);
ALTER TYPE public.gtrgm OWNER TO nemik;
--
-- Name: difference(text, text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION difference(text, text) RETURNS integer
AS '$libdir/fuzzystrmatch', 'difference'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.difference(text, text) OWNER TO nemik;
--
-- Name: dmetaphone(text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION dmetaphone(text) RETURNS text
AS '$libdir/fuzzystrmatch', 'dmetaphone'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.dmetaphone(text) OWNER TO nemik;
--
-- Name: dmetaphone_alt(text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION dmetaphone_alt(text) RETURNS text
AS '$libdir/fuzzystrmatch', 'dmetaphone_alt'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.dmetaphone_alt(text) OWNER TO nemik;
--
-- Name: gin_extract_trgm(text, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gin_extract_trgm(text, internal) RETURNS internal
AS '$libdir/pg_trgm', 'gin_extract_trgm'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gin_extract_trgm(text, internal) OWNER TO nemik;
--
-- Name: gin_extract_trgm(text, internal, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gin_extract_trgm(text, internal, internal) RETURNS internal
AS '$libdir/pg_trgm', 'gin_extract_trgm'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gin_extract_trgm(text, internal, internal) OWNER TO nemik;
--
-- Name: gin_trgm_consistent(internal, internal, text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gin_trgm_consistent(internal, internal, text) RETURNS internal
AS '$libdir/pg_trgm', 'gin_trgm_consistent'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gin_trgm_consistent(internal, internal, text) OWNER TO nemik;
--
-- Name: gtrgm_compress(internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_compress(internal) RETURNS internal
AS '$libdir/pg_trgm', 'gtrgm_compress'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_compress(internal) OWNER TO nemik;
--
-- Name: gtrgm_consistent(gtrgm, internal, integer); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_consistent(gtrgm, internal, integer) RETURNS boolean
AS '$libdir/pg_trgm', 'gtrgm_consistent'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_consistent(gtrgm, internal, integer) OWNER TO nemik;
--
-- Name: gtrgm_decompress(internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_decompress(internal) RETURNS internal
AS '$libdir/pg_trgm', 'gtrgm_decompress'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_decompress(internal) OWNER TO nemik;
--
-- Name: gtrgm_penalty(internal, internal, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_penalty(internal, internal, internal) RETURNS internal
AS '$libdir/pg_trgm', 'gtrgm_penalty'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.gtrgm_penalty(internal, internal, internal) OWNER TO nemik;
--
-- Name: gtrgm_picksplit(internal, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_picksplit(internal, internal) RETURNS internal
AS '$libdir/pg_trgm', 'gtrgm_picksplit'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_picksplit(internal, internal) OWNER TO nemik;
--
-- Name: gtrgm_same(gtrgm, gtrgm, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_same(gtrgm, gtrgm, internal) RETURNS internal
AS '$libdir/pg_trgm', 'gtrgm_same'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_same(gtrgm, gtrgm, internal) OWNER TO nemik;
--
-- Name: gtrgm_union(bytea, internal); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION gtrgm_union(bytea, internal) RETURNS integer[]
AS '$libdir/pg_trgm', 'gtrgm_union'
LANGUAGE c IMMUTABLE;
ALTER FUNCTION public.gtrgm_union(bytea, internal) OWNER TO nemik;
--
-- Name: levenshtein(text, text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION levenshtein(text, text) RETURNS integer
AS '$libdir/fuzzystrmatch', 'levenshtein'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.levenshtein(text, text) OWNER TO nemik;
--
-- Name: metaphone(text, integer); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION metaphone(text, integer) RETURNS text
AS '$libdir/fuzzystrmatch', 'metaphone'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.metaphone(text, integer) OWNER TO nemik;
--
-- Name: set_limit(real); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION set_limit(real) RETURNS real
AS '$libdir/pg_trgm', 'set_limit'
LANGUAGE c STRICT;
ALTER FUNCTION public.set_limit(real) OWNER TO nemik;
--
-- Name: show_limit(); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION show_limit() RETURNS real
AS '$libdir/pg_trgm', 'show_limit'
LANGUAGE c STABLE STRICT;
ALTER FUNCTION public.show_limit() OWNER TO nemik;
--
-- Name: show_trgm(text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION show_trgm(text) RETURNS text[]
AS '$libdir/pg_trgm', 'show_trgm'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.show_trgm(text) OWNER TO nemik;
--
-- Name: similarity(text, text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION similarity(text, text) RETURNS real
AS '$libdir/pg_trgm', 'similarity'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.similarity(text, text) OWNER TO nemik;
--
-- Name: similarity_op(text, text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION similarity_op(text, text) RETURNS boolean
AS '$libdir/pg_trgm', 'similarity_op'
LANGUAGE c STABLE STRICT;
ALTER FUNCTION public.similarity_op(text, text) OWNER TO nemik;
--
-- Name: soundex(text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION soundex(text) RETURNS text
AS '$libdir/fuzzystrmatch', 'soundex'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.soundex(text) OWNER TO nemik;
--
-- Name: text_soundex(text); Type: FUNCTION; Schema: public; Owner: nemik
--
CREATE FUNCTION text_soundex(text) RETURNS text
AS '$libdir/fuzzystrmatch', 'soundex'
LANGUAGE c IMMUTABLE STRICT;
ALTER FUNCTION public.text_soundex(text) OWNER TO nemik;
--
-- Name: %; Type: OPERATOR; Schema: public; Owner: nemik
--
CREATE OPERATOR % (
PROCEDURE = similarity_op,
LEFTARG = text,
RIGHTARG = text,
COMMUTATOR = %,
RESTRICT = contsel,
JOIN = contjoinsel
);
ALTER OPERATOR public.% (text, text) OWNER TO nemik;
--
-- Name: gin_trgm_ops; Type: OPERATOR CLASS; Schema: public; Owner: nemik
--
CREATE OPERATOR CLASS gin_trgm_ops
FOR TYPE text USING gin AS
STORAGE integer ,
OPERATOR 1 %(text,text) RECHECK ,
FUNCTION 1 btint4cmp(integer,integer) ,
FUNCTION 2 gin_extract_trgm(text,internal) ,
FUNCTION 3 gin_extract_trgm(text,internal,internal) ,
FUNCTION 4 gin_trgm_consistent(internal,internal,text);
ALTER OPERATOR CLASS public.gin_trgm_ops USING gin OWNER TO nemik;
--
-- Name: gist_trgm_ops; Type: OPERATOR CLASS; Schema: public; Owner: nemik
--
CREATE OPERATOR CLASS gist_trgm_ops
FOR TYPE text USING gist AS
STORAGE gtrgm ,
OPERATOR 1 %(text,text) ,
FUNCTION 1 gtrgm_consistent(gtrgm,internal,integer) ,
FUNCTION 2 gtrgm_union(bytea,internal) ,
FUNCTION 3 gtrgm_compress(internal) ,
FUNCTION 4 gtrgm_decompress(internal) ,
FUNCTION 5 gtrgm_penalty(internal,internal,internal) ,
FUNCTION 6 gtrgm_picksplit(internal,internal) ,
FUNCTION 7 gtrgm_same(gtrgm,gtrgm,internal);
ALTER OPERATOR CLASS public.gist_trgm_ops USING gist OWNER TO nemik;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: articles; Type: TABLE; Schema: public; Owner: nntp; Tablespace:
--
CREATE TABLE articles (
id text NOT NULL,
group_id bigint,
subject text,
poster text,
date bigint,
"time" timestamp without time zone
);
ALTER TABLE public.articles OWNER TO nntp;
--
-- Name: file_group_seq; Type: SEQUENCE; Schema: public; Owner: nntp
--
CREATE SEQUENCE file_group_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.file_group_seq OWNER TO nntp;
--
-- Name: file_group; Type: TABLE; Schema: public; Owner: nntp; Tablespace:
--
CREATE TABLE file_group (
id bigint DEFAULT nextval('file_group_seq'::regclass) NOT NULL,
file_id bigint,
group_id bigint
);
ALTER TABLE public.file_group OWNER TO nntp;
--
-- Name: files_seq; Type: SEQUENCE; Schema: public; Owner: nntp
--
CREATE SEQUENCE files_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.files_seq OWNER TO nntp;
--
-- Name: files; Type: TABLE; Schema: public; Owner: nntp; Tablespace:
--
CREATE TABLE files (
id bigint DEFAULT nextval('files_seq'::regclass) NOT NULL,
subject text,
name text,
poster text,
parts_total integer,
date bigint,
"time" timestamp without time zone
);
ALTER TABLE public.files OWNER TO nntp;
--
-- Name: groups_seq; Type: SEQUENCE; Schema: public; Owner: nntp
--
CREATE SEQUENCE groups_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER TABLE public.groups_seq OWNER TO nntp;
--
-- Name: groups; Type: TABLE; Schema: public; Owner: nntp; Tablespace:
--
CREATE TABLE groups (
id bigint DEFAULT nextval('groups_seq'::regclass) NOT NULL,
name text,
last_article bigint
);
ALTER TABLE public.groups OWNER TO nntp;
--
-- Name: parts; Type: TABLE; Schema: public; Owner: nntp; Tablespace:
--
CREATE TABLE parts (
id text NOT NULL,
file_id bigint,
bytes bigint,
number integer
);
ALTER TABLE public.parts OWNER TO nntp;
--
-- Name: articles_pkey; Type: CONSTRAINT; Schema: public; Owner: nntp; Tablespace:
--
ALTER TABLE ONLY articles
ADD CONSTRAINT articles_pkey PRIMARY KEY (id);
--
-- Name: file_group_pkey; Type: CONSTRAINT; Schema: public; Owner: nntp; Tablespace:
--
ALTER TABLE ONLY file_group
ADD CONSTRAINT file_group_pkey PRIMARY KEY (id);
--
-- Name: files_pkey; Type: CONSTRAINT; Schema: public; Owner: nntp; Tablespace:
--
ALTER TABLE ONLY files
ADD CONSTRAINT files_pkey PRIMARY KEY (id);
--
-- Name: groups_pkey; Type: CONSTRAINT; Schema: public; Owner: nntp; Tablespace:
--
ALTER TABLE ONLY groups
ADD CONSTRAINT groups_pkey PRIMARY KEY (id);
CREATE INDEX parts_id_idx ON parts USING btree (id);
--
-- Name: files_id_idx; Type: INDEX; Schema: public; Owner: nntp; Tablespace:
--
CREATE INDEX files_id_idx ON parts USING btree (file_id);
--
-- Name: files_name_trigram_index; Type: INDEX; Schema: public; Owner: nntp; Tablespace:
--
CREATE INDEX files_name_trigram_index ON files USING gist (subject gist_trgm_ops);
--
-- Name: articles_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: nntp
--
ALTER TABLE ONLY articles
ADD CONSTRAINT articles_group_id_fkey FOREIGN KEY (group_id) REFERENCES groups(id);
--
-- Name: file_group_file_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: nntp
--
ALTER TABLE ONLY file_group
ADD CONSTRAINT file_group_file_id_fkey FOREIGN KEY (file_id) REFERENCES files(id);
--
-- Name: file_group_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: nntp
--
ALTER TABLE ONLY file_group
ADD CONSTRAINT file_group_group_id_fkey FOREIGN KEY (group_id) REFERENCES groups(id);
--
-- Name: parts_file_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: nntp
--
ALTER TABLE ONLY parts
ADD CONSTRAINT parts_file_id_fkey FOREIGN KEY (file_id) REFERENCES files(id);
--
-- 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;
--
-- PostgreSQL database dump complete
--