@@ -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+ --
711SELECT spcname FROM pg_tablespace WHERE spcname = 'testts';
812 spcname
913---------
@@ -19,19 +23,19 @@ INSERT INTO testts1 (data) values ('b');
1923INSERT INTO testts1 (data) values ('c');
2024-- check the indexes definitions
2125SELECT 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')
2428FROM pg_index i join pg_class c ON c.oid = indexrelid
2529WHERE 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
3337SELECT 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')
3640FROM pg_index i join pg_class c ON c.oid = indexrelid
3741WHERE indrelid = 'testts1'::regclass ORDER BY relname;
@@ -43,27 +47,27 @@ WHERE indrelid = 'testts1'::regclass ORDER BY relname;
4347(3 rows)
4448
4549SELECT 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')
4852FROM pg_index i join pg_class c ON c.oid = indexrelid
4953WHERE 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
5761SELECT 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')
6064FROM pg_index i join pg_class c ON c.oid = indexrelid
6165WHERE 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
0 commit comments