@@ -166,6 +166,35 @@ btree, for table "testschema.test_default_tab"
166
166
Tablespace: "regress_tblspace"
167
167
168
168
DROP TABLE testschema.test_default_tab;
169
+ -- check that default_tablespace affects index additions in ALTER TABLE
170
+ CREATE TABLE testschema.test_tab(id int) TABLESPACE regress_tblspace;
171
+ INSERT INTO testschema.test_tab VALUES (1);
172
+ SET default_tablespace TO regress_tblspace;
173
+ ALTER TABLE testschema.test_tab ADD CONSTRAINT test_tab_unique UNIQUE (id);
174
+ SET default_tablespace TO '';
175
+ ALTER TABLE testschema.test_tab ADD CONSTRAINT test_tab_pkey PRIMARY KEY (id);
176
+ \d testschema.test_tab_unique
177
+ Index "testschema.test_tab_unique"
178
+ Column | Type | Definition
179
+ --------+---------+------------
180
+ id | integer | id
181
+ unique, btree, for table "testschema.test_tab"
182
+ Tablespace: "regress_tblspace"
183
+
184
+ \d testschema.test_tab_pkey
185
+ Index "testschema.test_tab_pkey"
186
+ Column | Type | Definition
187
+ --------+---------+------------
188
+ id | integer | id
189
+ primary key, btree, for table "testschema.test_tab"
190
+
191
+ SELECT * FROM testschema.test_tab;
192
+ id
193
+ ----
194
+ 1
195
+ (1 row)
196
+
197
+ DROP TABLE testschema.test_tab;
169
198
-- let's try moving a table from one place to another
170
199
CREATE TABLE testschema.atable AS VALUES (1), (2);
171
200
CREATE UNIQUE INDEX anindex ON testschema.atable(column1);
0 commit comments