blob: aff019aaca48025a470d823b30749c277f294224 [file] [log] [blame]
--
-- filespaces
--
--
-- *********************************************************************
-- *********************************************************************
-- If you want to change the results of this script, you must make the
-- changes in regress/output/filespace.source, not regress/results,
-- and use gpsourcify.pl to regenerate the ".source" file.
--
-- From the regress directory invoke the command:
--
-- gpsourcify.pl results/filespace.out > output/filespace.source
--
-- *********************************************************************
-- *********************************************************************
create filespace regressionfs1 @gpfilespace_regressionfs1@
;
create tablespace regressionts1 filespace regressionfs1;
create table fstest(a int, b int) tablespace regressionts1;
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this table.
HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
insert into fstest select i, i from generate_series (1,1000) i;
select * from fstest;
a | b
------+------
1 | 1
3 | 3
5 | 5
7 | 7
9 | 9
11 | 11
13 | 13
15 | 15
17 | 17
19 | 19
21 | 21
23 | 23
25 | 25
27 | 27
29 | 29
31 | 31
33 | 33
35 | 35
37 | 37
39 | 39
41 | 41
43 | 43
45 | 45
47 | 47
49 | 49
51 | 51
53 | 53
55 | 55
57 | 57
59 | 59
61 | 61
63 | 63
65 | 65
67 | 67
69 | 69
71 | 71
73 | 73
75 | 75
77 | 77
79 | 79
81 | 81
83 | 83
85 | 85
87 | 87
89 | 89
91 | 91
93 | 93
95 | 95
97 | 97
99 | 99
101 | 101
103 | 103
105 | 105
107 | 107
109 | 109
111 | 111
113 | 113
115 | 115
117 | 117
119 | 119
121 | 121
123 | 123
125 | 125
127 | 127
129 | 129
131 | 131
133 | 133
135 | 135
137 | 137
139 | 139
141 | 141
143 | 143
145 | 145
147 | 147
149 | 149
151 | 151
153 | 153
155 | 155
157 | 157
159 | 159
161 | 161
163 | 163
165 | 165
167 | 167
169 | 169
171 | 171
173 | 173
175 | 175
177 | 177
179 | 179
181 | 181
183 | 183
185 | 185
187 | 187
189 | 189
191 | 191
193 | 193
195 | 195
197 | 197
199 | 199
201 | 201
203 | 203
205 | 205
207 | 207
209 | 209
211 | 211
213 | 213
215 | 215
217 | 217
219 | 219
221 | 221
223 | 223
225 | 225
227 | 227
229 | 229
231 | 231
233 | 233
235 | 235
237 | 237
239 | 239
241 | 241
243 | 243
245 | 245
247 | 247
249 | 249
251 | 251
253 | 253
255 | 255
256 | 256
258 | 258
260 | 260
262 | 262
264 | 264
266 | 266
268 | 268
270 | 270
272 | 272
274 | 274
276 | 276
278 | 278
280 | 280
282 | 282
284 | 284
286 | 286
288 | 288
290 | 290
292 | 292
294 | 294
296 | 296
298 | 298
300 | 300
302 | 302
304 | 304
306 | 306
308 | 308
310 | 310
312 | 312
314 | 314
316 | 316
318 | 318
320 | 320
322 | 322
324 | 324
326 | 326
328 | 328
330 | 330
332 | 332
334 | 334
336 | 336
338 | 338
340 | 340
342 | 342
344 | 344
346 | 346
348 | 348
350 | 350
352 | 352
354 | 354
356 | 356
358 | 358
360 | 360
362 | 362
364 | 364
366 | 366
368 | 368
370 | 370
372 | 372
374 | 374
376 | 376
378 | 378
380 | 380
382 | 382
384 | 384
386 | 386
388 | 388
390 | 390
392 | 392
394 | 394
396 | 396
398 | 398
400 | 400
402 | 402
404 | 404
406 | 406
408 | 408
410 | 410
412 | 412
414 | 414
416 | 416
418 | 418
420 | 420
422 | 422
424 | 424
426 | 426
428 | 428
430 | 430
432 | 432
434 | 434
436 | 436
438 | 438
440 | 440
442 | 442
444 | 444
446 | 446
448 | 448
450 | 450
452 | 452
454 | 454
456 | 456
458 | 458
460 | 460
462 | 462
464 | 464
466 | 466
468 | 468
470 | 470
472 | 472
474 | 474
476 | 476
478 | 478
480 | 480
482 | 482
484 | 484
486 | 486
488 | 488
490 | 490
492 | 492
494 | 494
496 | 496
498 | 498
500 | 500
502 | 502
504 | 504
506 | 506
508 | 508
510 | 510
513 | 513
515 | 515
517 | 517
519 | 519
521 | 521
523 | 523
525 | 525
527 | 527
529 | 529
531 | 531
533 | 533
535 | 535
537 | 537
539 | 539
541 | 541
543 | 543
545 | 545
547 | 547
549 | 549
551 | 551
553 | 553
555 | 555
557 | 557
559 | 559
561 | 561
563 | 563
565 | 565
567 | 567
569 | 569
571 | 571
573 | 573
575 | 575
577 | 577
579 | 579
581 | 581
583 | 583
585 | 585
587 | 587
589 | 589
591 | 591
593 | 593
595 | 595
597 | 597
599 | 599
601 | 601
603 | 603
605 | 605
607 | 607
609 | 609
611 | 611
613 | 613
615 | 615
617 | 617
619 | 619
621 | 621
623 | 623
625 | 625
627 | 627
629 | 629
631 | 631
633 | 633
635 | 635
637 | 637
639 | 639
641 | 641
643 | 643
645 | 645
647 | 647
649 | 649
651 | 651
653 | 653
655 | 655
657 | 657
659 | 659
661 | 661
663 | 663
665 | 665
667 | 667
669 | 669
671 | 671
673 | 673
675 | 675
677 | 677
679 | 679
681 | 681
683 | 683
685 | 685
687 | 687
689 | 689
691 | 691
693 | 693
695 | 695
697 | 697
699 | 699
701 | 701
703 | 703
705 | 705
707 | 707
709 | 709
711 | 711
713 | 713
715 | 715
717 | 717
719 | 719
721 | 721
723 | 723
725 | 725
727 | 727
729 | 729
731 | 731
733 | 733
735 | 735
737 | 737
739 | 739
741 | 741
743 | 743
745 | 745
747 | 747
749 | 749
751 | 751
753 | 753
755 | 755
757 | 757
759 | 759
761 | 761
763 | 763
765 | 765
767 | 767
768 | 768
770 | 770
772 | 772
774 | 774
776 | 776
778 | 778
780 | 780
782 | 782
784 | 784
786 | 786
788 | 788
790 | 790
792 | 792
794 | 794
796 | 796
798 | 798
800 | 800
802 | 802
804 | 804
806 | 806
808 | 808
810 | 810
2 | 2
4 | 4
6 | 6
8 | 8
10 | 10
12 | 12
14 | 14
16 | 16
18 | 18
20 | 20
22 | 22
24 | 24
26 | 26
28 | 28
30 | 30
32 | 32
34 | 34
36 | 36
38 | 38
40 | 40
42 | 42
44 | 44
46 | 46
48 | 48
50 | 50
52 | 52
54 | 54
56 | 56
58 | 58
60 | 60
62 | 62
64 | 64
66 | 66
68 | 68
70 | 70
72 | 72
74 | 74
76 | 76
78 | 78
80 | 80
82 | 82
84 | 84
86 | 86
88 | 88
90 | 90
92 | 92
94 | 94
96 | 96
98 | 98
100 | 100
102 | 102
104 | 104
106 | 106
108 | 108
110 | 110
112 | 112
114 | 114
116 | 116
118 | 118
120 | 120
122 | 122
124 | 124
126 | 126
128 | 128
130 | 130
132 | 132
134 | 134
136 | 136
138 | 138
140 | 140
142 | 142
144 | 144
146 | 146
148 | 148
150 | 150
152 | 152
154 | 154
156 | 156
158 | 158
160 | 160
162 | 162
164 | 164
166 | 166
168 | 168
170 | 170
172 | 172
174 | 174
176 | 176
178 | 178
180 | 180
182 | 182
184 | 184
186 | 186
188 | 188
190 | 190
192 | 192
194 | 194
196 | 196
198 | 198
200 | 200
202 | 202
204 | 204
206 | 206
208 | 208
210 | 210
212 | 212
214 | 214
216 | 216
218 | 218
220 | 220
222 | 222
224 | 224
226 | 226
228 | 228
230 | 230
232 | 232
234 | 234
236 | 236
238 | 238
240 | 240
242 | 242
244 | 244
246 | 246
248 | 248
250 | 250
252 | 252
254 | 254
257 | 257
259 | 259
261 | 261
263 | 263
265 | 265
267 | 267
269 | 269
271 | 271
273 | 273
275 | 275
277 | 277
279 | 279
281 | 281
283 | 283
285 | 285
287 | 287
289 | 289
291 | 291
293 | 293
295 | 295
297 | 297
299 | 299
301 | 301
303 | 303
305 | 305
307 | 307
309 | 309
311 | 311
313 | 313
315 | 315
317 | 317
319 | 319
321 | 321
323 | 323
325 | 325
327 | 327
329 | 329
331 | 331
333 | 333
335 | 335
337 | 337
339 | 339
341 | 341
343 | 343
345 | 345
347 | 347
349 | 349
351 | 351
353 | 353
355 | 355
357 | 357
359 | 359
361 | 361
363 | 363
365 | 365
367 | 367
369 | 369
371 | 371
373 | 373
375 | 375
377 | 377
379 | 379
381 | 381
383 | 383
385 | 385
387 | 387
389 | 389
391 | 391
393 | 393
395 | 395
397 | 397
399 | 399
401 | 401
403 | 403
405 | 405
407 | 407
409 | 409
411 | 411
413 | 413
415 | 415
417 | 417
419 | 419
421 | 421
423 | 423
425 | 425
427 | 427
429 | 429
431 | 431
433 | 433
435 | 435
437 | 437
439 | 439
441 | 441
443 | 443
445 | 445
447 | 447
449 | 449
451 | 451
453 | 453
455 | 455
457 | 457
459 | 459
461 | 461
463 | 463
465 | 465
467 | 467
469 | 469
471 | 471
473 | 473
475 | 475
477 | 477
479 | 479
481 | 481
483 | 483
485 | 485
487 | 487
489 | 489
491 | 491
493 | 493
495 | 495
497 | 497
499 | 499
501 | 501
503 | 503
505 | 505
507 | 507
509 | 509
511 | 511
512 | 512
514 | 514
516 | 516
518 | 518
520 | 520
522 | 522
524 | 524
526 | 526
528 | 528
530 | 530
532 | 532
534 | 534
536 | 536
538 | 538
540 | 540
542 | 542
544 | 544
546 | 546
548 | 548
550 | 550
552 | 552
554 | 554
556 | 556
558 | 558
560 | 560
562 | 562
564 | 564
566 | 566
568 | 568
570 | 570
572 | 572
574 | 574
576 | 576
578 | 578
580 | 580
582 | 582
584 | 584
586 | 586
588 | 588
590 | 590
592 | 592
594 | 594
596 | 596
598 | 598
600 | 600
602 | 602
604 | 604
606 | 606
608 | 608
610 | 610
612 | 612
614 | 614
616 | 616
618 | 618
620 | 620
622 | 622
624 | 624
626 | 626
628 | 628
630 | 630
632 | 632
634 | 634
636 | 636
638 | 638
640 | 640
642 | 642
644 | 644
646 | 646
648 | 648
650 | 650
652 | 652
654 | 654
656 | 656
658 | 658
660 | 660
662 | 662
664 | 664
666 | 666
668 | 668
670 | 670
672 | 672
674 | 674
676 | 676
678 | 678
680 | 680
682 | 682
684 | 684
686 | 686
688 | 688
690 | 690
692 | 692
694 | 694
696 | 696
698 | 698
700 | 700
702 | 702
704 | 704
706 | 706
708 | 708
710 | 710
712 | 712
714 | 714
716 | 716
718 | 718
720 | 720
722 | 722
724 | 724
726 | 726
728 | 728
730 | 730
732 | 732
734 | 734
736 | 736
738 | 738
740 | 740
742 | 742
744 | 744
746 | 746
748 | 748
750 | 750
752 | 752
754 | 754
756 | 756
758 | 758
760 | 760
762 | 762
764 | 764
766 | 766
769 | 769
771 | 771
773 | 773
775 | 775
777 | 777
779 | 779
781 | 781
783 | 783
785 | 785
787 | 787
789 | 789
791 | 791
793 | 793
795 | 795
797 | 797
799 | 799
801 | 801
803 | 803
805 | 805
807 | 807
809 | 809
811 | 811
813 | 813
812 | 812
814 | 814
816 | 816
818 | 818
820 | 820
822 | 822
824 | 824
826 | 826
828 | 828
830 | 830
832 | 832
834 | 834
836 | 836
838 | 838
840 | 840
842 | 842
844 | 844
846 | 846
848 | 848
850 | 850
852 | 852
854 | 854
856 | 856
858 | 858
860 | 860
862 | 862
864 | 864
866 | 866
868 | 868
870 | 870
872 | 872
874 | 874
876 | 876
878 | 878
880 | 880
882 | 882
884 | 884
886 | 886
888 | 888
890 | 890
892 | 892
894 | 894
896 | 896
898 | 898
900 | 900
902 | 902
904 | 904
906 | 906
908 | 908
910 | 910
912 | 912
914 | 914
916 | 916
918 | 918
920 | 920
922 | 922
924 | 924
926 | 926
928 | 928
930 | 930
932 | 932
934 | 934
936 | 936
938 | 938
940 | 940
942 | 942
944 | 944
946 | 946
948 | 948
950 | 950
952 | 952
954 | 954
956 | 956
958 | 958
960 | 960
962 | 962
964 | 964
966 | 966
968 | 968
970 | 970
972 | 972
974 | 974
976 | 976
978 | 978
980 | 980
982 | 982
984 | 984
986 | 986
988 | 988
990 | 990
992 | 992
994 | 994
996 | 996
998 | 998
1000 | 1000
815 | 815
817 | 817
819 | 819
821 | 821
823 | 823
825 | 825
827 | 827
829 | 829
831 | 831
833 | 833
835 | 835
837 | 837
839 | 839
841 | 841
843 | 843
845 | 845
847 | 847
849 | 849
851 | 851
853 | 853
855 | 855
857 | 857
859 | 859
861 | 861
863 | 863
865 | 865
867 | 867
869 | 869
871 | 871
873 | 873
875 | 875
877 | 877
879 | 879
881 | 881
883 | 883
885 | 885
887 | 887
889 | 889
891 | 891
893 | 893
895 | 895
897 | 897
899 | 899
901 | 901
903 | 903
905 | 905
907 | 907
909 | 909
911 | 911
913 | 913
915 | 915
917 | 917
919 | 919
921 | 921
923 | 923
925 | 925
927 | 927
929 | 929
931 | 931
933 | 933
935 | 935
937 | 937
939 | 939
941 | 941
943 | 943
945 | 945
947 | 947
949 | 949
951 | 951
953 | 953
955 | 955
957 | 957
959 | 959
961 | 961
963 | 963
965 | 965
967 | 967
969 | 969
971 | 971
973 | 973
975 | 975
977 | 977
979 | 979
981 | 981
983 | 983
985 | 985
987 | 987
989 | 989
991 | 991
993 | 993
995 | 995
997 | 997
999 | 999
(1000 rows)
comment on filespace regressionfs1 is 'groovy';
comment on tablespace regressionts1 is 'also groovy';
-- partition coverage
create table cov1 (a int, b int)
distributed by (a)
partition by range (b)
(
partition p1 start (1) end (2)
with (appendonly=true) tablespace regressionts1,
partition p2 start (2) end (3) tablespace regressionts1,
partition p3 start (3) end (4)
with (appendonly=true) tablespace regressionts1
);
NOTICE: CREATE TABLE will create partition "cov1_1_prt_p1" for table "cov1"
NOTICE: CREATE TABLE will create partition "cov1_1_prt_p2" for table "cov1"
NOTICE: CREATE TABLE will create partition "cov1_1_prt_p3" for table "cov1"
-- view is busted??
select tablename, partitionname, partitiontablename, parenttablespace,
partitiontablespace from pg_partitions where tablename = 'cov1';
tablename | partitionname | partitiontablename | parenttablespace | partitiontablespace
-----------+---------------+--------------------+------------------+---------------------
cov1 | p1 | cov1_1_prt_p1 | pg_default | regressionts1
cov1 | p2 | cov1_1_prt_p2 | pg_default | regressionts1
cov1 | p3 | cov1_1_prt_p3 | pg_default | regressionts1
(3 rows)
drop table cov1;
-- err: not empty
drop tablespace regressionts1;
ERROR: tablespace "regressionts1" is not empty
-- err: not empty
drop filespace regressionfs1;
ERROR: filespace "regressionfs1" is not empty
drop table fstest;
-- bad name
create tablespace pg_badname filespace regressionfs1;
ERROR: unacceptable tablespace name "pg_badname"
DETAIL: The prefix "pg_" is reserved for system tablespaces.
create tablespace rtsfake filespace badname_badfs1;
ERROR: filespace "badname_badfs1" does not exist
-- reserved
create tablespace rtsfake filespace pg_system;
ERROR: permission denied to create tablespace "rtsfake"
HINT: filespace pg_system is reserved for system use
-- duplicate
create tablespace regressionts1 filespace regressionfs1;
ERROR: tablespace "regressionts1" already exists
-- caql coverage for tablecmds.c
drop table if exists ttable;
create tablespace ttbspace filespace regressionfs1;
create table ttable (a int, b int) tablespace regressionts1;
alter table ttable set tablespace ttbspace;
drop table ttable;
-- do some alters
create user fsuser1;
NOTICE: resource queue required -- using default resource queue "pg_default"
alter tablespace regressionts1 rename to rts2;
alter tablespace rts2 rename to regressionts1;
alter filespace regressionfs1 rename to rfs2;
alter filespace rfs2 rename to regressionfs1;
-- privs
alter tablespace regressionts1 owner to fsuser1;
alter filespace regressionfs1 owner to fsuser1;
SET SESSION AUTHORIZATION fsuser1;
create tablespace rtsfake filespace regressionfs1;
ERROR: permission denied to create tablespace "rtsfake"
HINT: Must be superuser to create a tablespace.
create filespace regressionfs2 @gpfilespace_regressionfs2@
;
ERROR: permission denied to create filespace "regressionfs2"
HINT: Must be superuser to create a filespace.
-- switch to superuser
\c -
-- bad name
drop tablespace funky.regressionts1;
ERROR: tablespace name may not be qualified
-- don't do this!
drop filespace pg_system;
ERROR: cannot drop filespace pg_system because it is required by the database system (filespace.c:554)
drop tablespace pg_default;
ERROR: permission denied for tablespace pg_default
drop tablespace pg_global;
ERROR: permission denied for tablespace pg_global
-- test tablespace and filespace aclcheck
drop user if exists tbs_user1;
drop user if exists tbs_user2;
create user tbs_user1;
NOTICE: resource queue required -- using default resource queue "pg_default"
create user tbs_user2;
NOTICE: resource queue required -- using default resource queue "pg_default"
alter tablespace ttbspace owner to tbs_user1;
set session authorization tbs_user1;
alter tablespace ttbspace owner to tbs_user2;
ERROR: must be member of role "tbs_user2"
alter filespace regressionfs1 owner to tbs_user1;
ERROR: must be owner of filespace regressionfs1
reset session authorization;
-- cleanup
drop tablespace regressionts1;
drop tablespace ttbspace;
drop filespace regressionfs1;
drop user fsuser1;
drop user tbs_user1;
drop user tbs_user2;