-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabaseLeddit.sql
More file actions
1272 lines (917 loc) · 38.8 KB
/
DatabaseLeddit.sql
File metadata and controls
1272 lines (917 loc) · 38.8 KB
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
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--
-- PostgreSQL database dump
--
-- Dumped from database version 13.1
-- Dumped by pg_dump version 13.1
-- Started on 2021-01-06 15:37:41
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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 xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- TOC entry 3173 (class 1262 OID 17626)
-- Name: reddit; Type: DATABASE; Schema: -; Owner: postgres
--
CREATE DATABASE reddit WITH TEMPLATE = template0 ENCODING = 'UTF8' LOCALE = 'Italian_Italy.1252';
ALTER DATABASE reddit OWNER TO postgres;
\connect reddit
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_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 xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- TOC entry 200 (class 1259 OID 17627)
-- Name: amicizia; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.amicizia (
utente1 character varying(20) NOT NULL,
utente2 character varying(20) NOT NULL
);
ALTER TABLE public.amicizia OWNER TO postgres;
--
-- TOC entry 201 (class 1259 OID 17630)
-- Name: award; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.award (
utente character varying(20) NOT NULL,
commento integer NOT NULL,
tipo character(1) NOT NULL,
dataacquisto date NOT NULL
);
ALTER TABLE public.award OWNER TO postgres;
--
-- TOC entry 202 (class 1259 OID 17633)
-- Name: ban; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.ban (
sub character varying(20) NOT NULL,
utente character varying(20) NOT NULL,
moderatore character varying(20) NOT NULL,
modsub character varying(20) NOT NULL,
databan date NOT NULL,
scadenza date,
motivo character varying(255) NOT NULL
);
ALTER TABLE public.ban OWNER TO postgres;
--
-- TOC entry 203 (class 1259 OID 17636)
-- Name: commento; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.commento (
id integer NOT NULL,
datacommento date NOT NULL,
contenuto character varying(500) NOT NULL,
isrisposta integer,
utente character varying(20) NOT NULL,
post integer NOT NULL,
isdeleted bit(1) DEFAULT '0'::"bit" NOT NULL,
votocommento integer DEFAULT 0 NOT NULL
);
ALTER TABLE public.commento OWNER TO postgres;
--
-- TOC entry 204 (class 1259 OID 17644)
-- Name: commento_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.commento_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.commento_id_seq OWNER TO postgres;
--
-- TOC entry 3174 (class 0 OID 0)
-- Dependencies: 204
-- Name: commento_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.commento_id_seq OWNED BY public.commento.id;
--
-- TOC entry 205 (class 1259 OID 17646)
-- Name: feed; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.feed (
utente character varying(20) NOT NULL,
nome character varying(30) NOT NULL
);
ALTER TABLE public.feed OWNER TO postgres;
--
-- TOC entry 206 (class 1259 OID 17649)
-- Name: include; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.include (
feed character varying(30) NOT NULL,
utente character varying(20) NOT NULL,
sub character varying(20) NOT NULL
);
ALTER TABLE public.include OWNER TO postgres;
--
-- TOC entry 207 (class 1259 OID 17652)
-- Name: iscrizione; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.iscrizione (
utente character varying(20) NOT NULL,
sub character varying(20) NOT NULL
);
ALTER TABLE public.iscrizione OWNER TO postgres;
--
-- TOC entry 208 (class 1259 OID 17655)
-- Name: media; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.media (
id integer NOT NULL,
nome character varying(30),
descrizione character varying(30),
percorso character varying(60) NOT NULL,
tipo character varying(5) NOT NULL,
tag character varying(100),
CONSTRAINT media_tipo_check CHECK (((tipo)::text = ANY (ARRAY[('foto'::character varying)::text, ('video'::character varying)::text, ('link'::character varying)::text])))
);
ALTER TABLE public.media OWNER TO postgres;
--
-- TOC entry 209 (class 1259 OID 17659)
-- Name: media_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.media_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.media_id_seq OWNER TO postgres;
--
-- TOC entry 3175 (class 0 OID 0)
-- Dependencies: 209
-- Name: media_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.media_id_seq OWNED BY public.media.id;
--
-- TOC entry 210 (class 1259 OID 17661)
-- Name: post; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.post (
id integer NOT NULL,
titolo character varying(100) NOT NULL,
datacreazione date NOT NULL,
contenuto character varying(500) NOT NULL,
nsfw bit(1) NOT NULL,
creatore character varying(20) NOT NULL,
sub character varying(20) NOT NULL,
numerovoti integer DEFAULT 0 NOT NULL,
isdeleted bit(1) DEFAULT '0'::"bit" NOT NULL
);
ALTER TABLE public.post OWNER TO postgres;
--
-- TOC entry 211 (class 1259 OID 17669)
-- Name: sub; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.sub (
nome character varying(20) NOT NULL,
datacreazione date NOT NULL,
descrizione character varying(255) NOT NULL,
ispremium bit(1) NOT NULL,
nsfw bit(1) NOT NULL,
creatore character varying(20) NOT NULL
);
ALTER TABLE public.sub OWNER TO postgres;
--
-- TOC entry 222 (class 1259 OID 17926)
-- Name: mediavotisub; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.mediavotisub AS
SELECT s.nome,
(avg(p.numerovoti))::numeric(100,2) AS media
FROM (public.sub s
JOIN public.post p ON (((s.nome)::text = (p.sub)::text)))
GROUP BY s.nome;
ALTER TABLE public.mediavotisub OWNER TO postgres;
--
-- TOC entry 212 (class 1259 OID 17677)
-- Name: messaggio; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.messaggio (
id integer NOT NULL,
datainvio date NOT NULL,
contenuto character varying(255) NOT NULL,
mittente character varying(20) NOT NULL,
destinatario character varying(20) NOT NULL
);
ALTER TABLE public.messaggio OWNER TO postgres;
--
-- TOC entry 213 (class 1259 OID 17680)
-- Name: messaggio_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.messaggio_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.messaggio_id_seq OWNER TO postgres;
--
-- TOC entry 3176 (class 0 OID 0)
-- Dependencies: 213
-- Name: messaggio_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.messaggio_id_seq OWNED BY public.messaggio.id;
--
-- TOC entry 214 (class 1259 OID 17682)
-- Name: moderatore; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.moderatore (
utente character varying(20) NOT NULL,
sub character varying(20) NOT NULL,
datainizio date NOT NULL
);
ALTER TABLE public.moderatore OWNER TO postgres;
--
-- TOC entry 223 (class 1259 OID 17931)
-- Name: numerobanpermoderatore; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.numerobanpermoderatore AS
SELECT m.sub,
m.utente,
count(*) AS numeroban
FROM (public.moderatore m
JOIN public.ban b ON ((((m.utente)::text = (b.moderatore)::text) AND ((m.sub)::text = (b.modsub)::text))))
GROUP BY m.sub, m.utente;
ALTER TABLE public.numerobanpermoderatore OWNER TO postgres;
--
-- TOC entry 224 (class 1259 OID 17935)
-- Name: numerocommentipost; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.numerocommentipost AS
SELECT p.id,
count(*) AS commenti
FROM (public.post p
JOIN public.commento c ON ((p.id = c.post)))
GROUP BY p.id;
ALTER TABLE public.numerocommentipost OWNER TO postgres;
--
-- TOC entry 215 (class 1259 OID 17693)
-- Name: post_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.post_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.post_id_seq OWNER TO postgres;
--
-- TOC entry 3177 (class 0 OID 0)
-- Dependencies: 215
-- Name: post_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.post_id_seq OWNED BY public.post.id;
--
-- TOC entry 216 (class 1259 OID 17695)
-- Name: prezzo; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.prezzo (
tipo character(1) NOT NULL,
costo numeric(3,1) NOT NULL
);
ALTER TABLE public.prezzo OWNER TO postgres;
--
-- TOC entry 217 (class 1259 OID 17698)
-- Name: utente; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.utente (
username character varying(20) NOT NULL,
password character varying(30) NOT NULL,
email character varying(320) NOT NULL,
dataiscrizione date NOT NULL,
isadmin bit(1) DEFAULT '0'::"bit" NOT NULL,
isdeleted bit(1) DEFAULT '0'::"bit" NOT NULL
);
ALTER TABLE public.utente OWNER TO postgres;
--
-- TOC entry 218 (class 1259 OID 17703)
-- Name: votocommento; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.votocommento (
utente character varying(20) NOT NULL,
commento integer NOT NULL,
valore integer NOT NULL,
CONSTRAINT votocommento_valore_check CHECK (((valore = '-1'::integer) OR (valore = (+ 1))))
);
ALTER TABLE public.votocommento OWNER TO postgres;
--
-- TOC entry 221 (class 1259 OID 17922)
-- Name: voticommentoutente; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.voticommentoutente AS
SELECT u.username,
sum(v.valore) AS voticommento
FROM (public.utente u
JOIN public.votocommento v ON (((u.username)::text = (v.utente)::text)))
GROUP BY u.username;
ALTER TABLE public.voticommentoutente OWNER TO postgres;
--
-- TOC entry 219 (class 1259 OID 17710)
-- Name: votopost; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.votopost (
utente character varying(20) NOT NULL,
post integer NOT NULL,
valore integer NOT NULL,
CONSTRAINT votopost_valore_check CHECK (((valore = '-1'::integer) OR (valore = (+ 1))))
);
ALTER TABLE public.votopost OWNER TO postgres;
--
-- TOC entry 220 (class 1259 OID 17918)
-- Name: votipostutente; Type: VIEW; Schema: public; Owner: postgres
--
CREATE VIEW public.votipostutente AS
SELECT u.username,
sum(v.valore) AS votipost
FROM (public.utente u
JOIN public.votopost v ON (((u.username)::text = (v.utente)::text)))
GROUP BY u.username;
ALTER TABLE public.votipostutente OWNER TO postgres;
--
-- TOC entry 2940 (class 2604 OID 17717)
-- Name: commento id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.commento ALTER COLUMN id SET DEFAULT nextval('public.commento_id_seq'::regclass);
--
-- TOC entry 2941 (class 2604 OID 17718)
-- Name: media id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.media ALTER COLUMN id SET DEFAULT nextval('public.media_id_seq'::regclass);
--
-- TOC entry 2946 (class 2604 OID 17719)
-- Name: messaggio id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.messaggio ALTER COLUMN id SET DEFAULT nextval('public.messaggio_id_seq'::regclass);
--
-- TOC entry 2945 (class 2604 OID 17720)
-- Name: post id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.post ALTER COLUMN id SET DEFAULT nextval('public.post_id_seq'::regclass);
--
-- TOC entry 3148 (class 0 OID 17627)
-- Dependencies: 200
-- Data for Name: amicizia; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.amicizia VALUES ('kharrow0', 'gbleything7');
INSERT INTO public.amicizia VALUES ('kharrow0', 'spetrashov8');
INSERT INTO public.amicizia VALUES ('kharrow0', 'asawerse');
INSERT INTO public.amicizia VALUES ('kharrow0', 'dcrunkhorng');
INSERT INTO public.amicizia VALUES ('gbleything7', 'dcrunkhorng');
INSERT INTO public.amicizia VALUES ('gbleything7', 'spetrashov8');
--
-- TOC entry 3149 (class 0 OID 17630)
-- Dependencies: 201
-- Data for Name: award; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.award VALUES ('mslineyc', 3, 'a', '2021-01-02');
INSERT INTO public.award VALUES ('mslineyc', 0, 'o', '2021-01-02');
INSERT INTO public.award VALUES ('smedgwick6', 3, 'p', '2021-01-02');
--
-- TOC entry 3150 (class 0 OID 17633)
-- Dependencies: 202
-- Data for Name: ban; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.ban VALUES ('gaming', 'rsatterfitt3', 'kharrow0', 'gaming', '2021-01-02', '2021-01-12', 'Commenti inappropriati.');
INSERT INTO public.ban VALUES ('pictures', 'rsatterfitt3', 'kharrow0', 'pictures', '2021-01-02', '2021-01-12', 'Commenti inappropriati.');
INSERT INTO public.ban VALUES ('italy', 'rsatterfitt3', 'gbleything7', 'italy', '2021-01-02', NULL, 'Commenti inappropriati.');
INSERT INTO public.ban VALUES ('gaming', 'fbagnal4', 'kharrow0', 'gaming', '2021-01-04', NULL, 'Commenti inappropriati');
INSERT INTO public.ban VALUES ('gaming', 'rsatterfitt3', 'kharrow0', 'gaming', '2021-01-04', NULL, 'Commenti inappropriati');
--
-- TOC entry 3151 (class 0 OID 17636)
-- Dependencies: 203
-- Data for Name: commento; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.commento VALUES (0, '2021-01-01', 'Contenuto del commento', NULL, 'oscrannagej', 3, B'0', 3);
INSERT INTO public.commento VALUES (2, '2021-01-01', 'Contenuto del commento', 2, 'oscrannagej', 3, B'0', 3);
INSERT INTO public.commento VALUES (1, '2021-01-01', 'Contenuto del commento', 1, 'plidsterd', 3, B'0', -1);
INSERT INTO public.commento VALUES (3, '2021-01-01', 'Contenuto del commento', NULL, 'oscrannagej', 0, B'0', 4);
INSERT INTO public.commento VALUES (4, '2021-01-04', 'Contenuto del commento', NULL, 'rsatterfitt3', 0, B'0', 0);
INSERT INTO public.commento VALUES (5, '2021-01-04', 'Contenuto del commento', NULL, 'rsatterfitt3', 2, B'0', 0);
INSERT INTO public.commento VALUES (6, '2021-01-04', 'Contenuto del commento', NULL, 'rsatterfitt3', 1, B'0', 0);
INSERT INTO public.commento VALUES (7, '2021-01-04', 'Contenuto del commento', NULL, 'gvasyutin5', 0, B'0', 0);
INSERT INTO public.commento VALUES (8, '2021-01-04', 'Contenuto del commento', NULL, 'fbagnal4', 2, B'0', 0);
INSERT INTO public.commento VALUES (9, '2021-01-04', 'Contenuto del commento', NULL, 'smedgwick6', 1, B'0', 0);
--
-- TOC entry 3153 (class 0 OID 17646)
-- Dependencies: 205
-- Data for Name: feed; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.feed VALUES ('asawerse', 'videogames');
INSERT INTO public.feed VALUES ('kharrow0', 'subs');
--
-- TOC entry 3154 (class 0 OID 17649)
-- Dependencies: 206
-- Data for Name: include; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.include VALUES ('videogames', 'asawerse', 'gaming');
INSERT INTO public.include VALUES ('videogames', 'asawerse', 'PlayStation');
INSERT INTO public.include VALUES ('subs', 'kharrow0', 'italy');
INSERT INTO public.include VALUES ('subs', 'kharrow0', 'gaming');
INSERT INTO public.include VALUES ('subs', 'kharrow0', 'pictures');
INSERT INTO public.include VALUES ('subs', 'kharrow0', 'PlayStation');
--
-- TOC entry 3155 (class 0 OID 17652)
-- Dependencies: 207
-- Data for Name: iscrizione; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.iscrizione VALUES ('kharrow0', 'gold');
INSERT INTO public.iscrizione VALUES ('kharrow0', 'italy');
INSERT INTO public.iscrizione VALUES ('kharrow0', 'gaming');
INSERT INTO public.iscrizione VALUES ('gbleything7', 'italy');
INSERT INTO public.iscrizione VALUES ('gbleything7', 'gaming');
INSERT INTO public.iscrizione VALUES ('vferrierif', 'italy');
INSERT INTO public.iscrizione VALUES ('vferrierif', 'gaming');
INSERT INTO public.iscrizione VALUES ('vferrierif', 'pictures');
INSERT INTO public.iscrizione VALUES ('oscrannagej', 'italy');
INSERT INTO public.iscrizione VALUES ('oscrannagej', 'pictures');
INSERT INTO public.iscrizione VALUES ('ptolotti1', 'gaming');
INSERT INTO public.iscrizione VALUES ('ptolotti1', 'pictures');
INSERT INTO public.iscrizione VALUES ('squinet9', 'gaming');
--
-- TOC entry 3156 (class 0 OID 17655)
-- Dependencies: 208
-- Data for Name: media; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.media VALUES (1, 'Funny dog', NULL, 'dog.jpg', 'foto', 'dogs pic funny');
INSERT INTO public.media VALUES (0, NULL, NULL, 'italy.mp4', 'video', 'funny italy italia');
--
-- TOC entry 3160 (class 0 OID 17677)
-- Dependencies: 212
-- Data for Name: messaggio; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.messaggio VALUES (0, '2020-01-01', '"Davvero?"', 'kharrow0', 'gbleything7');
INSERT INTO public.messaggio VALUES (1, '2019-10-11', '"https://www.youtube.com/watch?v=dQw4w9WgXcQ"', 'kharrow0', 'asawerse');
INSERT INTO public.messaggio VALUES (2, '2021-01-01', '"Buon anno!"', 'gbleything7', 'dcrunkhorng');
INSERT INTO public.messaggio VALUES (3, '2020-12-25', '":)"', 'gbleything7', 'asawerse');
--
-- TOC entry 3162 (class 0 OID 17682)
-- Dependencies: 214
-- Data for Name: moderatore; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.moderatore VALUES ('kharrow0', 'gold', '2020-01-01');
INSERT INTO public.moderatore VALUES ('kharrow0', 'gaming', '2021-01-01');
INSERT INTO public.moderatore VALUES ('kharrow0', 'pictures', '2010-01-01');
INSERT INTO public.moderatore VALUES ('asawerse', 'PlayStation', '2020-01-02');
INSERT INTO public.moderatore VALUES ('gbleything7', 'italy', '2020-12-20');
INSERT INTO public.moderatore VALUES ('smedgwick6', 'gaming', '2021-01-02');
INSERT INTO public.moderatore VALUES ('oscrannagej', 'gaming', '2021-01-02');
INSERT INTO public.moderatore VALUES ('asawerse', 'italy', '2021-01-02');
--
-- TOC entry 3158 (class 0 OID 17661)
-- Dependencies: 210
-- Data for Name: post; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.post VALUES (0, 'Primo post', '2020-12-31', 'Contenuto del post', B'0', 'kharrow0', 'italy', 3, B'0');
INSERT INTO public.post VALUES (1, 'Funny dog pic', '2021-01-01', 'Contenuto del post', B'0', 'ptolotti1', 'pictures', 5, B'0');
INSERT INTO public.post VALUES (3, 'PS5 vs XBSX', '2021-01-01', 'Contenuto del post', B'0', 'ptolotti1', 'gaming', -3, B'0');
INSERT INTO public.post VALUES (2, 'upgrade suggestions', '2021-01-01', 'Contenuto del post', B'0', 'vferrierif', 'gaming', 3, B'0');
INSERT INTO public.post VALUES (4, 'Consigli', '2021-01-03', 'Contenuto del post', B'0', 'kharrow0', 'italy', 1, B'0');
--
-- TOC entry 3164 (class 0 OID 17695)
-- Dependencies: 216
-- Data for Name: prezzo; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.prezzo VALUES ('a', 5.0);
INSERT INTO public.prezzo VALUES ('o', 7.5);
INSERT INTO public.prezzo VALUES ('p', 10.5);
--
-- TOC entry 3159 (class 0 OID 17669)
-- Dependencies: 211
-- Data for Name: sub; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.sub VALUES ('gold', '2020-01-01', 'Leddit premium community:)', B'1', B'0', 'kharrow0');
INSERT INTO public.sub VALUES ('italy', '2020-12-20', 'Welcome everyone! This is a place to post and discuss anything related to Italy. We also speak English!', B'0', B'0', 'gbleything7');
INSERT INTO public.sub VALUES ('gaming', '2021-01-01', 'A subleddit for (almost) anything related to games - video games, board games, card games, etc. (but not sports).', B'0', B'0', 'kharrow0');
INSERT INTO public.sub VALUES ('pictures', '2010-01-01', 'A place for pictures and photographs.', B'0', B'1', 'kharrow0');
INSERT INTO public.sub VALUES ('PlayStation', '2020-01-02', 'Everything PS', B'0', B'0', 'asawerse');
--
-- TOC entry 3165 (class 0 OID 17698)
-- Dependencies: 217
-- Data for Name: utente; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.utente VALUES ('kharrow0', 'ebT5ZKGCfwm5', 'tzanneli0@php.net', '2020-11-16', B'0', B'0');
INSERT INTO public.utente VALUES ('ptolotti1', 'OcGoGRM', 'awapple1@delicious.com', '2020-10-06', B'0', B'0');
INSERT INTO public.utente VALUES ('ekondratovich2', 'ZUTpcwFAaHB', 'ostronach2@vistaprint.com', '2020-09-07', B'0', B'0');
INSERT INTO public.utente VALUES ('rsatterfitt3', 'XBUj7HHCvRh', 'crobjents3@si.edu', '2020-03-07', B'0', B'0');
INSERT INTO public.utente VALUES ('fbagnal4', '3uVejDhtK', 'wgreet4@ycombinator.com', '2020-10-31', B'0', B'0');
INSERT INTO public.utente VALUES ('gvasyutin5', 'RyjYswLSVu', 'jfairlie5@slideshare.net', '2020-05-13', B'0', B'0');
INSERT INTO public.utente VALUES ('smedgwick6', 'BIDNj9PpnDV', 'plinton6@rediff.com', '2020-12-24', B'0', B'0');
INSERT INTO public.utente VALUES ('gbleything7', 'db7WkgW04nyx', 'ttheis7@google.ru', '2020-07-20', B'0', B'0');
INSERT INTO public.utente VALUES ('spetrashov8', 'hTIPCYJUwd', 'lhellen8@admin.ch', '2020-04-01', B'0', B'0');
INSERT INTO public.utente VALUES ('squinet9', 'IZIPCH3qBW83', 'scrighton9@webmd.com', '2020-02-09', B'0', B'0');
INSERT INTO public.utente VALUES ('mkornesa', 'pxCPtHkXAi', 'cdirobertoa@ustream.tv', '2020-10-28', B'0', B'0');
INSERT INTO public.utente VALUES ('mslineyc', '7wotXujaoliy', 'ojakovc@auda.org.au', '2020-01-31', B'0', B'0');
INSERT INTO public.utente VALUES ('asawerse', 'MRd57FrdkKf', 'eleidle@usgs.gov', '2020-06-15', B'0', B'0');
INSERT INTO public.utente VALUES ('vferrierif', 'J37u0ecD', 'mbastidef@shutterfly.com', '2020-11-11', B'0', B'0');
INSERT INTO public.utente VALUES ('dcrunkhorng', 'ylan4PwpW2', 'acastagnerig@usatoday.com', '2020-08-16', B'0', B'0');
INSERT INTO public.utente VALUES ('rblackhallh', 'p0tH2851tp', 'fwilcockesh@technorati.com', '2020-03-02', B'0', B'0');
INSERT INTO public.utente VALUES ('mfitchetti', '1BuL57FMFHs', 'jruddochi@marriott.com', '2020-11-29', B'0', B'0');
INSERT INTO public.utente VALUES ('oscrannagej', 'As2dAxD', 'wgallantj@joomla.org', '2020-01-22', B'0', B'0');
INSERT INTO public.utente VALUES ('vpinchingb', 'Aakvd8MYRy', 'rkelkb@taobao.com', '2020-04-22', B'1', B'0');
INSERT INTO public.utente VALUES ('plidsterd', 'wH4IUAxrOI', 'bkoubekd@phoca.cz', '2020-08-23', B'1', B'0');
--
-- TOC entry 3166 (class 0 OID 17703)
-- Dependencies: 218
-- Data for Name: votocommento; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.votocommento VALUES ('oscrannagej', 0, 1);
INSERT INTO public.votocommento VALUES ('oscrannagej', 1, 1);
INSERT INTO public.votocommento VALUES ('oscrannagej', 2, 1);
INSERT INTO public.votocommento VALUES ('oscrannagej', 3, 1);
INSERT INTO public.votocommento VALUES ('vferrierif', 1, -1);
INSERT INTO public.votocommento VALUES ('vferrierif', 3, 1);
INSERT INTO public.votocommento VALUES ('vferrierif', 0, 1);
INSERT INTO public.votocommento VALUES ('rblackhallh', 2, 1);
INSERT INTO public.votocommento VALUES ('rblackhallh', 0, 1);
INSERT INTO public.votocommento VALUES ('smedgwick6', 2, 1);
INSERT INTO public.votocommento VALUES ('smedgwick6', 3, 1);
INSERT INTO public.votocommento VALUES ('asawerse', 1, -1);
INSERT INTO public.votocommento VALUES ('kharrow0', 3, 1);
--
-- TOC entry 3167 (class 0 OID 17710)
-- Dependencies: 219
-- Data for Name: votopost; Type: TABLE DATA; Schema: public; Owner: postgres
--
INSERT INTO public.votopost VALUES ('kharrow0', 0, 1);
INSERT INTO public.votopost VALUES ('vferrierif', 0, 1);
INSERT INTO public.votopost VALUES ('ptolotti1', 0, 1);
INSERT INTO public.votopost VALUES ('kharrow0', 1, 1);
INSERT INTO public.votopost VALUES ('vferrierif', 1, 1);
INSERT INTO public.votopost VALUES ('ptolotti1', 1, 1);
INSERT INTO public.votopost VALUES ('mkornesa', 1, 1);
INSERT INTO public.votopost VALUES ('rsatterfitt3', 1, 1);
INSERT INTO public.votopost VALUES ('kharrow0', 3, -1);
INSERT INTO public.votopost VALUES ('mkornesa', 3, -1);
INSERT INTO public.votopost VALUES ('mslineyc', 3, -1);
INSERT INTO public.votopost VALUES ('gbleything7', 2, 1);
INSERT INTO public.votopost VALUES ('mkornesa', 2, 1);
INSERT INTO public.votopost VALUES ('asawerse', 2, 1);
INSERT INTO public.votopost VALUES ('kharrow0', 4, 1);
--
-- TOC entry 3178 (class 0 OID 0)
-- Dependencies: 204
-- Name: commento_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.commento_id_seq', 1, true);
--
-- TOC entry 3179 (class 0 OID 0)
-- Dependencies: 209
-- Name: media_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.media_id_seq', 1, false);
--
-- TOC entry 3180 (class 0 OID 0)
-- Dependencies: 213
-- Name: messaggio_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.messaggio_id_seq', 1, false);
--
-- TOC entry 3181 (class 0 OID 0)
-- Dependencies: 215
-- Name: post_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.post_id_seq', 1, false);
--
-- TOC entry 2952 (class 2606 OID 17722)
-- Name: amicizia amicizia_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.amicizia
ADD CONSTRAINT amicizia_pkey PRIMARY KEY (utente1, utente2);
--
-- TOC entry 2954 (class 2606 OID 17724)
-- Name: award award_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.award
ADD CONSTRAINT award_pkey PRIMARY KEY (utente, commento);
--
-- TOC entry 2957 (class 2606 OID 17726)
-- Name: ban ban_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.ban
ADD CONSTRAINT ban_pkey PRIMARY KEY (sub, utente, databan);
--
-- TOC entry 2960 (class 2606 OID 17728)
-- Name: commento commento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.commento
ADD CONSTRAINT commento_pkey PRIMARY KEY (id);
--
-- TOC entry 2962 (class 2606 OID 17730)
-- Name: feed feed_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.feed
ADD CONSTRAINT feed_pkey PRIMARY KEY (utente, nome);
--
-- TOC entry 2964 (class 2606 OID 17940)
-- Name: include include_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.include
ADD CONSTRAINT include_pkey PRIMARY KEY (feed, utente, sub);
--
-- TOC entry 2966 (class 2606 OID 17734)
-- Name: iscrizione iscrizione_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.iscrizione
ADD CONSTRAINT iscrizione_pkey PRIMARY KEY (utente, sub);
--
-- TOC entry 2968 (class 2606 OID 17736)
-- Name: media media_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.media
ADD CONSTRAINT media_pkey PRIMARY KEY (id);
--
-- TOC entry 2974 (class 2606 OID 17738)
-- Name: messaggio messaggio_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.messaggio
ADD CONSTRAINT messaggio_pkey PRIMARY KEY (id);
--
-- TOC entry 2976 (class 2606 OID 17740)
-- Name: moderatore moderatore_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.moderatore
ADD CONSTRAINT moderatore_pkey PRIMARY KEY (utente, sub);
--
-- TOC entry 2970 (class 2606 OID 17742)
-- Name: post post_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.post
ADD CONSTRAINT post_pkey PRIMARY KEY (id);
--
-- TOC entry 2978 (class 2606 OID 17744)
-- Name: prezzo prezzo_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.prezzo
ADD CONSTRAINT prezzo_pkey PRIMARY KEY (tipo);
--
-- TOC entry 2972 (class 2606 OID 17746)
-- Name: sub sub_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.sub
ADD CONSTRAINT sub_pkey PRIMARY KEY (nome);
--
-- TOC entry 2980 (class 2606 OID 17748)
-- Name: utente utente_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.utente
ADD CONSTRAINT utente_pkey PRIMARY KEY (username);
--
-- TOC entry 2982 (class 2606 OID 17750)
-- Name: votocommento votocommento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.votocommento
ADD CONSTRAINT votocommento_pkey PRIMARY KEY (utente, commento);
--
-- TOC entry 2984 (class 2606 OID 17752)
-- Name: votopost votopost_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.votopost
ADD CONSTRAINT votopost_pkey PRIMARY KEY (utente, post);
--
-- TOC entry 2958 (class 1259 OID 17916)
-- Name: indiceban; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX indiceban ON public.ban USING btree (utente);
--
-- TOC entry 2955 (class 1259 OID 17917)
-- Name: indiceperutentipremium; Type: INDEX; Schema: public; Owner: postgres
--
CREATE INDEX indiceperutentipremium ON public.award USING btree (utente);
--
-- TOC entry 2985 (class 2606 OID 17755)
-- Name: amicizia amicizia_utente1_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.amicizia
ADD CONSTRAINT amicizia_utente1_fkey FOREIGN KEY (utente1) REFERENCES public.utente(username);
--
-- TOC entry 2986 (class 2606 OID 17760)
-- Name: amicizia amicizia_utente2_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.amicizia
ADD CONSTRAINT amicizia_utente2_fkey FOREIGN KEY (utente2) REFERENCES public.utente(username);
--
-- TOC entry 2987 (class 2606 OID 17765)
-- Name: award award_commento_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.award
ADD CONSTRAINT award_commento_fkey FOREIGN KEY (commento) REFERENCES public.commento(id);
--
-- TOC entry 2988 (class 2606 OID 17770)
-- Name: award award_tipo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.award
ADD CONSTRAINT award_tipo_fkey FOREIGN KEY (tipo) REFERENCES public.prezzo(tipo);
--
-- TOC entry 2989 (class 2606 OID 17775)
-- Name: award award_utente_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.award
ADD CONSTRAINT award_utente_fkey FOREIGN KEY (utente) REFERENCES public.utente(username);
--
-- TOC entry 2990 (class 2606 OID 17780)
-- Name: ban ban_moderatore_modsub_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.ban