@@ -61,24 +61,52 @@ SELECT relname, spcname FROM pg_catalog.pg_tablespace t, pg_catalog.pg_class c
61
61
foo_idx | regress_tblspace
62
62
(1 row)
63
63
64
+ --
64
65
-- partitioned table
66
+ --
65
67
CREATE TABLE testschema.part (a int) PARTITION BY LIST (a);
66
- CREATE TABLE testschema.part12 PARTITION OF testschema.part FOR VALUES IN(1,2) PARTITION BY LIST (a) TABLESPACE regress_tblspace;
67
- CREATE TABLE testschema.part12_1 PARTITION OF testschema.part12 FOR VALUES IN (1);
68
- ALTER TABLE testschema.part12 SET TABLESPACE pg_default;
69
- CREATE TABLE testschema.part12_2 PARTITION OF testschema.part12 FOR VALUES IN (2);
70
- -- Ensure part12_1 defaulted to regress_tblspace and part12_2 defaulted to pg_default.
68
+ SET default_tablespace TO pg_global;
69
+ CREATE TABLE testschema.part_1 PARTITION OF testschema.part FOR VALUES IN (1);
70
+ ERROR: only shared relations can be placed in pg_global tablespace
71
+ RESET default_tablespace;
72
+ CREATE TABLE testschema.part_1 PARTITION OF testschema.part FOR VALUES IN (1);
73
+ SET default_tablespace TO regress_tblspace;
74
+ CREATE TABLE testschema.part_2 PARTITION OF testschema.part FOR VALUES IN (2);
75
+ SET default_tablespace TO pg_global;
76
+ CREATE TABLE testschema.part_3 PARTITION OF testschema.part FOR VALUES IN (3);
77
+ ERROR: only shared relations can be placed in pg_global tablespace
78
+ ALTER TABLE testschema.part SET TABLESPACE regress_tblspace;
79
+ CREATE TABLE testschema.part_3 PARTITION OF testschema.part FOR VALUES IN (3);
80
+ CREATE TABLE testschema.part_4 PARTITION OF testschema.part FOR VALUES IN (4)
81
+ TABLESPACE pg_default;
82
+ CREATE TABLE testschema.part_56 PARTITION OF testschema.part FOR VALUES IN (5, 6)
83
+ PARTITION BY LIST (a);
84
+ ALTER TABLE testschema.part SET TABLESPACE pg_default;
85
+ CREATE TABLE testschema.part_78 PARTITION OF testschema.part FOR VALUES IN (7, 8)
86
+ PARTITION BY LIST (a);
87
+ ERROR: only shared relations can be placed in pg_global tablespace
88
+ CREATE TABLE testschema.part_910 PARTITION OF testschema.part FOR VALUES IN (9, 10)
89
+ PARTITION BY LIST (a) TABLESPACE regress_tblspace;
90
+ RESET default_tablespace;
91
+ CREATE TABLE testschema.part_78 PARTITION OF testschema.part FOR VALUES IN (7, 8)
92
+ PARTITION BY LIST (a);
71
93
SELECT relname, spcname FROM pg_catalog.pg_class c
94
+ JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid)
72
95
LEFT JOIN pg_catalog.pg_tablespace t ON c.reltablespace = t.oid
73
- where c.relname LIKE 'part%' order by relname;
96
+ where c.relname LIKE 'part%' AND n.nspname = 'testschema' order by relname;
74
97
relname | spcname
75
98
----------+------------------
76
99
part |
77
- part12 |
78
- part12_1 | regress_tblspace
79
- part12_2 |
80
- (4 rows)
81
-
100
+ part_1 |
101
+ part_2 | regress_tblspace
102
+ part_3 | regress_tblspace
103
+ part_4 |
104
+ part_56 | regress_tblspace
105
+ part_78 |
106
+ part_910 | regress_tblspace
107
+ (8 rows)
108
+
109
+ RESET default_tablespace;
82
110
DROP TABLE testschema.part;
83
111
-- partitioned index
84
112
CREATE TABLE testschema.part (a int) PARTITION BY LIST (a);
0 commit comments