3838$$ language plpgsql;
3939
4040-- create tablespaces we can use
41+ \set testtablespace_unlogged :testtablespace ' _unlogged'
4142CREATE TABLESPACE testspace LOCATION :' testtablespace' ;
42- CREATE TABLESPACE ul_testspace LOCATION :' testtablespace ' ' _unlogged ' ;
43+ CREATE TABLESPACE ul_testspace LOCATION :' testtablespace_unlogged ' ;
4344SELECT gp_segment_id,
4445 CASE tblspc_loc
4546 WHEN :' testtablespace' THEN ' testtablespace'
@@ -48,7 +49,7 @@ SELECT gp_segment_id,
4849FROM gp_tablespace_location((SELECT oid FROM pg_tablespace WHERE spcname= ' testspace' ));
4950SELECT gp_segment_id,
5051 CASE tblspc_loc
51- WHEN :' testtablespace ' ' _unlogged ' THEN ' testtablespace_unlogged'
52+ WHEN :' testtablespace_unlogged ' THEN ' testtablespace_unlogged'
5253 ELSE ' testtablespace_unknown'
5354 END AS tblspc_loc
5455FROM gp_tablespace_location((SELECT oid FROM pg_tablespace WHERE spcname= ' ul_testspace' ));
@@ -61,7 +62,7 @@ FROM pg_tablespace WHERE spcname = 'testspace';
6162
6263-- Ensure mirrors have applied filesystem changes
6364SELECT force_mirrors_to_catch_up();
64- \! ls :' testtablespace' ;
65+ \! ls :testtablespace;
6566
6667-- Test moving AO/AOCO tables from one tablespace to another.
6768CREATE TABLE ao_ts_table (id int4, t text ) with (appendonly= true, orientation= row) distributed by (id);
@@ -190,19 +191,21 @@ drop table aoco_ul_ctas;
190191drop table space ul_testspace;
191192
192193-- Cloudberry tablespaces have the option to define tablespace location for specific segments
193- CREATE TABLESPACE testspace_otherloc LOCATION :' testtablespace' WITH (content9999= :' testtablespace' ' _otherloc' ); -- should fail
194- CREATE TABLESPACE testspace_otherloc LOCATION :' testtablespace' WITH (content1= :' testtablespace' ' _otherloc' );
194+ \set testtablespace_otherloc :testtablespace ' _otherloc'
195+ CREATE TABLESPACE testspace_otherloc LOCATION :' testtablespace' WITH (content9999= :' testtablespace_otherloc' ); -- should fail
196+ CREATE TABLESPACE testspace_otherloc LOCATION :' testtablespace' WITH (content1= :' testtablespace_otherloc' );
195197SELECT gp_segment_id,
196198 CASE tblspc_loc
197199 WHEN :' testtablespace' THEN ' testtablespace'
198- WHEN :' testtablespace ' ' _otherloc ' THEN ' testtablespace_otherloc'
200+ WHEN :' testtablespace_otherloc ' THEN ' testtablespace_otherloc'
199201 ELSE ' testtablespace_unknown'
200202 END AS tblspc_loc
201203FROM gp_tablespace_location((SELECT oid FROM pg_tablespace WHERE spcname= ' testspace_otherloc' ));
202204
203205-- Create a tablespace with an existing GP_TABLESPACE_VERSION_DIRECTORY for
204206-- another version of GPDB.
205- CREATE TABLESPACE testspace_existing_version_dir LOCATION ' @testtablespace@_existing_version_dir' ;
207+ \set testtablespace_existing_version_dir :testtablespace ' _existing_version_dir'
208+ CREATE TABLESPACE testspace_existing_version_dir LOCATION :' testtablespace_existing_version_dir' ;
206209
207210SELECT * FROM
208211 (SELECT pg_ls_dir(' pg_tblspc/' || oid ) AS versiondirs
@@ -224,7 +227,8 @@ DROP TABLESPACE testspace_existing_version_dir;
224227
225228-- Ensure mirrors have applied filesystem changes
226229SELECT force_mirrors_to_catch_up();
227- \! ls :' testtablespace' _existing_version_dir/* ;
230+ \set testtablespace_existing_version_dir :testtablespace ' _existing_version_dir'
231+ \! ls testtablespace_existing_version_dir/* ;
228232
229233-- Test alter tablespace: PG does not seem to test these.
230234
@@ -253,7 +257,7 @@ SELECT COUNT(*) FROM tblspc_otherloc_heap;
253257DROP TABLE tblspc_otherloc_heap;
254258DROP TABLESPACE testspace_otherloc;
255259
256- CREATE TABLESPACE testspace_dir_empty LOCATION '@ testtablespace@ ';
260+ CREATE TABLESPACE testspace_dir_empty LOCATION :' testtablespace';
257261CREATE TABLE t_dir_empty(a int);
258262\! rm -rf @testtablespace@/*;
259263DROP TABLE IF EXISTS t_dir_empty;
0 commit comments