Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4cc6a3f

Browse files
committed
Check that default_tablespace affects ALTER TABLE ADD UNIQUE/PRIMARY KEY.
Seems like a good thing to test, considering that we nearly broke ityesterday.Michael Paquier
1 parent4aaddf2 commit4cc6a3f

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

‎src/test/regress/input/tablespace.source

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ ALTER TABLE testschema.test_default_tab ALTER id TYPE bigint;
7575
\d testschema.test_index2
7676
DROP TABLE testschema.test_default_tab;
7777

78+
-- check that default_tablespace affects index additions in ALTER TABLE
79+
CREATE TABLE testschema.test_tab(id int) TABLESPACE regress_tblspace;
80+
INSERT INTO testschema.test_tab VALUES (1);
81+
SET default_tablespace TO regress_tblspace;
82+
ALTER TABLE testschema.test_tab ADD CONSTRAINT test_tab_unique UNIQUE (id);
83+
SET default_tablespace TO '';
84+
ALTER TABLE testschema.test_tab ADD CONSTRAINT test_tab_pkey PRIMARY KEY (id);
85+
\d testschema.test_tab_unique
86+
\d testschema.test_tab_pkey
87+
SELECT * FROM testschema.test_tab;
88+
DROP TABLE testschema.test_tab;
89+
7890
-- let's try moving a table from one place to another
7991
CREATE TABLE testschema.atable AS VALUES (1), (2);
8092
CREATE UNIQUE INDEX anindex ON testschema.atable(column1);

‎src/test/regress/output/tablespace.source

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,35 @@ btree, for table "testschema.test_default_tab"
166166
Tablespace: "regress_tblspace"
167167

168168
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;
169198
-- let's try moving a table from one place to another
170199
CREATE TABLE testschema.atable AS VALUES (1), (2);
171200
CREATE UNIQUE INDEX anindex ON testschema.atable(column1);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp