Skip to content

Commit 3dbb3f1

Browse files
committed
Add more comments about test tablespace creation.
1 parent 115fd3d commit 3dbb3f1

3 files changed

Lines changed: 32 additions & 24 deletions

File tree

.github/workflows/regression.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: echo "$PWD/bin" >> $GITHUB_PATH
3333

3434
- name: Create testts directory
35-
run: sudo -u postgres mkdir /tmp/testts
35+
run: sudo -u postgres mkdir /tmp/testts && chmod 0700 /tmp/testts
3636

3737
- name: Create testts tablespace
3838
run: sudo -u postgres psql -c "CREATE TABLESPACE testts LOCATION '/tmp/testts'"

regress/expected/tablespace.out

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ SET client_min_messages = warning;
44
--
55
-- Note: in order to pass this test you must create a tablespace called 'testts'
66
--
7+
-- Test tablespace creation example:
8+
-- $ sudo -u postgres mkdir /tmp/testts && chmod 0700 /tmp/testts
9+
-- $ sudo -u postgres psql -c "CREATE TABLESPACE testts LOCATION '/tmp/testts'"
10+
--
711
SELECT spcname FROM pg_tablespace WHERE spcname = 'testts';
812
spcname
913
---------
@@ -19,19 +23,19 @@ INSERT INTO testts1 (data) values ('b');
1923
INSERT INTO testts1 (data) values ('c');
2024
-- check the indexes definitions
2125
SELECT regexp_replace(
22-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, false),
26+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, false), ' TABLESPACE pg_default', ''),
2327
'_[0-9]+', '_OID', 'g')
2428
FROM pg_index i join pg_class c ON c.oid = indexrelid
2529
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
26-
regexp_replace
27-
----------------------------------------------------------------------------------------------------------
28-
CREATE INDEX index_OID ON repack.table_OID USING btree (id) TABLESPACE pg_default WHERE (id > 0)
29-
CREATE UNIQUE INDEX index_OID ON repack.table_OID USING btree (id) TABLESPACE pg_default
30-
CREATE INDEX index_OID ON repack.table_OID USING btree (id) WITH (fillfactor='80') TABLESPACE pg_default
30+
regexp_replace
31+
------------------------------------------------------------------------------------
32+
CREATE INDEX index_OID ON repack.table_OID USING btree (id) WHERE (id > 0)
33+
CREATE UNIQUE INDEX index_OID ON repack.table_OID USING btree (id)
34+
CREATE INDEX index_OID ON repack.table_OID USING btree (id) WITH (fillfactor='80')
3135
(3 rows)
3236

3337
SELECT regexp_replace(
34-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', false),
38+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', false), ' TABLESPACE pg_default', ''),
3539
'_[0-9]+', '_OID', 'g')
3640
FROM pg_index i join pg_class c ON c.oid = indexrelid
3741
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
@@ -43,27 +47,27 @@ WHERE indrelid = 'testts1'::regclass ORDER BY relname;
4347
(3 rows)
4448

4549
SELECT regexp_replace(
46-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, true),
50+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, true), ' TABLESPACE pg_default', ''),
4751
'_[0-9]+', '_OID', 'g')
4852
FROM pg_index i join pg_class c ON c.oid = indexrelid
4953
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
50-
regexp_replace
51-
--------------------------------------------------------------------------------------------------------------
52-
CREATE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) TABLESPACE pg_default WHERE (id > 0)
53-
CREATE UNIQUE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) TABLESPACE pg_default
54-
CREATE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) WITH (fillfactor='80') TABLESPACE pg_default
54+
regexp_replace
55+
-----------------------------------------------------------------------------------------------
56+
CREATE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id) WHERE (id > 0)
57+
CREATE UNIQUE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id)
58+
CREATE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id) WITH (fillfactor='80')
5559
(3 rows)
5660

5761
SELECT regexp_replace(
58-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', true),
62+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', true), ' TABLESPACE pg_default', ''),
5963
'_[0-9]+', '_OID', 'g')
6064
FROM pg_index i join pg_class c ON c.oid = indexrelid
6165
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
62-
regexp_replace
63-
-------------------------------------------------------------------------------------------------------
64-
CREATE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) TABLESPACE foo WHERE (id > 0)
65-
CREATE UNIQUE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) TABLESPACE foo
66-
CREATE INDEX CONCURRENTLY index_OID ON testts1 USING btree (id) WITH (fillfactor='80') TABLESPACE foo
66+
regexp_replace
67+
--------------------------------------------------------------------------------------------------------------
68+
CREATE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id) TABLESPACE foo WHERE (id > 0)
69+
CREATE UNIQUE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id) TABLESPACE foo
70+
CREATE INDEX CONCURRENTLY index_OID ON public.testts1 USING btree (id) WITH (fillfactor='80') TABLESPACE foo
6771
(3 rows)
6872

6973
-- can move the tablespace from default

regress/sql/tablespace.sql

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ SET client_min_messages = warning;
55
--
66
-- Note: in order to pass this test you must create a tablespace called 'testts'
77
--
8+
-- Test tablespace creation example:
9+
-- $ sudo -u postgres mkdir /tmp/testts && chmod 0700 /tmp/testts
10+
-- $ sudo -u postgres psql -c "CREATE TABLESPACE testts LOCATION '/tmp/testts'"
11+
--
812

913
SELECT spcname FROM pg_tablespace WHERE spcname = 'testts';
1014
-- If the query above failed you must create the 'testts' tablespace;
@@ -18,25 +22,25 @@ INSERT INTO testts1 (data) values ('c');
1822

1923
-- check the indexes definitions
2024
SELECT regexp_replace(
21-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, false),
25+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, false), ' TABLESPACE pg_default', ''),
2226
'_[0-9]+', '_OID', 'g')
2327
FROM pg_index i join pg_class c ON c.oid = indexrelid
2428
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
2529

2630
SELECT regexp_replace(
27-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', false),
31+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', false), ' TABLESPACE pg_default', ''),
2832
'_[0-9]+', '_OID', 'g')
2933
FROM pg_index i join pg_class c ON c.oid = indexrelid
3034
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
3135

3236
SELECT regexp_replace(
33-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, true),
37+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, NULL, true), ' TABLESPACE pg_default', ''),
3438
'_[0-9]+', '_OID', 'g')
3539
FROM pg_index i join pg_class c ON c.oid = indexrelid
3640
WHERE indrelid = 'testts1'::regclass ORDER BY relname;
3741

3842
SELECT regexp_replace(
39-
repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', true),
43+
replace(repack.repack_indexdef(indexrelid, 'testts1'::regclass, 'foo', true), ' TABLESPACE pg_default', ''),
4044
'_[0-9]+', '_OID', 'g')
4145
FROM pg_index i join pg_class c ON c.oid = indexrelid
4246
WHERE indrelid = 'testts1'::regclass ORDER BY relname;

0 commit comments

Comments
 (0)