This is an automated email from the ASF dual-hosted git repository.

chenjinbao1989 pushed a commit to branch cbdb-postgres-merge
in repository https://gitbox.apache.org/repos/asf/cloudberry.git


The following commit(s) were added to refs/heads/cbdb-postgres-merge by this 
push:
     new 180cce26ba4 Fix directory table
180cce26ba4 is described below

commit 180cce26ba41ff830dd2aac92b0ea29b617e08d1
Author: Jinbao Chen <[email protected]>
AuthorDate: Thu Jan 8 01:00:43 2026 +0800

    Fix directory table
---
 src/backend/catalog/pg_class.c                     |   2 +
 src/backend/commands/copyfrom.c                    |   3 +
 src/backend/optimizer/util/plancat.c               |   1 +
 src/include/catalog/pg_class.h                     |   1 +
 src/test/regress/expected/bb_memory_quota.out      |   4 +-
 src/test/regress/expected/directory_table.out      | 339 +++++++++++----------
 src/test/regress/expected/external_table.out       |   3 +-
 .../external_table_persistent_error_log.out        |   3 +-
 src/test/regress/sql/alter_db_set_tablespace.sql   |  30 +-
 src/test/regress/sql/bb_memory_quota.sql           |   4 +-
 src/test/regress/sql/directory_table.sql           | 108 +++----
 src/test/regress/sql/external_table.sql            |   2 +-
 .../sql/external_table_persistent_error_log.sql    |   2 +-
 13 files changed, 262 insertions(+), 240 deletions(-)

diff --git a/src/backend/catalog/pg_class.c b/src/backend/catalog/pg_class.c
index d9921ad70c8..94dc6d18fc1 100644
--- a/src/backend/catalog/pg_class.c
+++ b/src/backend/catalog/pg_class.c
@@ -45,6 +45,8 @@ errdetail_relkind_not_supported(char relkind)
                        return errdetail("This operation is not supported for 
partitioned tables.");
                case RELKIND_PARTITIONED_INDEX:
                        return errdetail("This operation is not supported for 
partitioned indexes.");
+               case RELKIND_DIRECTORY_TABLE:
+                       return errdetail("This operation is not supported for 
partitioned indexes.");
                default:
                        elog(ERROR, "unrecognized relkind: '%c'", relkind);
                        return 0;
diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c
index f616f653c94..2855dd6d799 100644
--- a/src/backend/commands/copyfrom.c
+++ b/src/backend/commands/copyfrom.c
@@ -1567,6 +1567,9 @@ BeginCopyFromDirectoryTable(ParseState *pstate,
 
        num_phys_attrs = tupDesc->natts;
 
+       cstate->defaults = (bool *) palloc0(tupDesc->natts * sizeof(bool));
+       cstate->num_defaults = tupDesc->natts;
+
        cstate->attnumlist = CopyGetAttnums(tupDesc, cstate->rel, NIL);
 
        /*
diff --git a/src/backend/optimizer/util/plancat.c 
b/src/backend/optimizer/util/plancat.c
index 29f4994051a..ee2454bd62d 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -151,6 +151,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, 
bool inhparent,
        if (!relation->rd_tableam)
        {
                if (!(relation->rd_rel->relkind == RELKIND_FOREIGN_TABLE ||
+                         relation->rd_rel->relkind == RELKIND_DIRECTORY_TABLE 
||
                          relation->rd_rel->relkind == 
RELKIND_PARTITIONED_TABLE))
                        ereport(ERROR,
                                        (errcode(ERRCODE_WRONG_OBJECT_TYPE),
diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h
index 2eac2c6b433..0b1964b6288 100644
--- a/src/include/catalog/pg_class.h
+++ b/src/include/catalog/pg_class.h
@@ -245,6 +245,7 @@ DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, 
ClassTblspcRelfilenodeInd
  */
 #define RELKIND_HAS_TABLE_AM(relkind) \
        ((relkind) == RELKIND_RELATION || \
+        (relkind) == RELKIND_DIRECTORY_TABLE || \
         (relkind) == RELKIND_TOASTVALUE || \
         (relkind) == RELKIND_AOSEGMENTS || \
         (relkind) == RELKIND_AOBLOCKDIR || \
diff --git a/src/test/regress/expected/bb_memory_quota.out 
b/src/test/regress/expected/bb_memory_quota.out
index 066bc45f531..1b11232cf82 100644
--- a/src/test/regress/expected/bb_memory_quota.out
+++ b/src/test/regress/expected/bb_memory_quota.out
@@ -5,9 +5,9 @@ create resource queue memquota_resqueue1 active threshold 4;
 alter resource queue memquota_resqueue1 with (memory_limit = '500MB');
 alter role memquota_role1 with resource queue memquota_resqueue1;
 -- concurrency = statement limit of the resource queue
-\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=4 
--dbname=regress --username=memquota_role1
+\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=4 
--dbname=regress --username=memquota_role1
 -- trigger query waiting
-\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=15 
--dbname=regress --username=memquota_role1
+\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=15 
--dbname=regress --username=memquota_role1
 -- use 'auto' memory allocation policy
 set gp_resqueue_memory_policy=auto;
 (select count(*) from (select o0.o_orderkey from (heap_orders o0 left outer 
join heap_orders o1 on o0.o_orderkey = o1.o_orderkey left outer join 
heap_orders o2 on o2.o_orderkey = o1.o_orderkey left outer join heap_orders o3 
on o3.o_orderkey = o2.o_orderkey left outer join heap_orders o4 on 
o4.o_orderkey = o3.o_orderkey) order by o0.o_orderkey) as foo);
diff --git a/src/test/regress/expected/directory_table.out 
b/src/test/regress/expected/directory_table.out
index 3fdc23bec19..e1f045cfdb3 100644
--- a/src/test/regress/expected/directory_table.out
+++ b/src/test/regress/expected/directory_table.out
@@ -73,8 +73,10 @@ SELECT relname, relisshared, relpersistence, relkind FROM 
pg_class WHERE relname
  gp_storage_user_mapping | t           | p              | r
 (1 row)
 
+\getenv abs_builddir PG_ABS_BUILDDIR
+\set testtablespace :abs_builddir '/testtablespace'
 -- CREATE TABLESPACE
-CREATE TABLESPACE directory_tblspc LOCATION '@testtablespace@';
+CREATE TABLESPACE directory_tblspc LOCATION :'testtablespace';
 -- CREATE DATABASE
 CREATE DATABASE dirtable_db;
 \c dirtable_db
@@ -771,63 +773,65 @@ SELECT relative_path, size, tag FROM dir_table2 ORDER BY 
1;
 ---------------+------+-----
 (0 rows)
 
-\COPY dir_table1 FROM '@abs_srcdir@/data/nation.csv';    -- fail
+\getenv abs_srcdir PG_ABS_SRCDIR
+\set nation_file :abs_srcdir '/data/nation.csv'
+COPY dir_table1 FROM :'nation_file';    -- fail
 ERROR:  Copy from directory table file name can't be null.
-\COPY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation'; -- fail
+COPY dir_table1 FROM :'nation_file' 'nation'; -- fail
 ERROR:  Only support copy binary from directory table.
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv';    -- fail
+COPY BINARY dir_table1 FROM :'nation_file';    -- fail
 ERROR:  Copy from directory table file name can't be null.
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation1';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation1'; -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation1';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation1'; -- fail
 ERROR:  duplicate key value violates unique constraint "dir_table1_pkey"
 DETAIL:  Key (relative_path)=(nation1) already exists.
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation2' 
'nation2'; -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation2' 'nation2'; -- fail
 ERROR:  syntax error at or near "'nation2'"
-LINE 1: COPY BINARY dir_table1 FROM STDIN 'nation2' 'nation2'; -- fa...
-                                                    ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation2';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation3' WITH TAG 
'nation';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=31193)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation3' WITH TAG 
'nation';    -- fail
+LINE 1: ...berry/src/test/regress/data/nation.csv' 'nation2' 'nation2';
+                                                             ^
+COPY BINARY dir_table1 FROM :'nation_file' 'nation2';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=900444)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';    -- 
fail
 ERROR:  duplicate key value violates unique constraint "dir_table1_pkey"
 DETAIL:  Key (relative_path)=(nation3) already exists.
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation3' WITH TAG 
'nation2';    -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation2';    -- 
fail
 ERROR:  duplicate key value violates unique constraint "dir_table1_pkey"
 DETAIL:  Key (relative_path)=(nation3) already exists.
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation4' WITH TAG 
'nation';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=31192)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation5' WITH TAG 
'nation' WITH TAG 'nation2';    -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation4' WITH TAG 'nation';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=900444)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation5' WITH TAG 'nation' WITH 
TAG 'nation2';    -- fail
 ERROR:  syntax error at or near "WITH"
-LINE 1: ...dir_table1 FROM STDIN 'nation5' WITH TAG 'nation' WITH TAG '...
+LINE 1: ...ress/data/nation.csv' 'nation5' WITH TAG 'nation' WITH TAG '...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation6';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation7';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation8';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation9';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation10';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation11';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation12';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation13';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation14';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=21791)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation15';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation16';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation17';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=21792)
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation18';
-NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=21790)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation6';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=900442)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation7';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation8';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation9';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation10';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=900444)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation11';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=900442)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation12';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation13';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation14';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=900444)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation15';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=900442)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation16';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation17';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg1 127.0.1.1:7003 pid=900443)
+COPY BINARY dir_table1 FROM :'nation_file' 'nation18';
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg0 127.0.1.1:7002 pid=900442)
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
@@ -872,24 +876,25 @@ SELECT relative_path, content FROM 
directory_table('dir_table1') ORDER BY 1;
  nation9       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
 (17 rows)
 
-COPY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv';     -- fail
+\set cat_nation_file 'cat ' :abs_srcdir '/data/nation.csv'
+COPY dir_table2 FROM PROGRAM :'cat_nation_file';     -- fail
 ERROR:  Copy from directory table file name can't be null.
-COPY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 'nation';  -- 
fail
+COPY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation';  -- fail
 ERROR:  Only support copy binary from directory table.
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation1';
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation1'; -- fail
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation1';
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation1'; -- fail
 ERROR:  duplicate key value violates unique constraint "dir_table2_pkey"
 DETAIL:  Key (relative_path)=(nation1) already exists.
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation2';
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation3' WITH TAG 'nation';
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation3' WITH TAG 'nation';    -- fail
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation2';
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation3' WITH TAG 
'nation';
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation3' WITH TAG 
'nation';    -- fail
 ERROR:  duplicate key value violates unique constraint "dir_table2_pkey"
 DETAIL:  Key (relative_path)=(nation3) already exists.
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation3' WITH TAG 'nation2';    -- fail
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation3' WITH TAG 
'nation2';    -- fail
 ERROR:  duplicate key value violates unique constraint "dir_table2_pkey"
 DETAIL:  Key (relative_path)=(nation3) already exists.
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation4' WITH TAG 'nation';
-COPY BINARY dir_table2 FROM PROGRAM 'cat @abs_srcdir@/data/nation.csv' 
'nation5' WITH TAG 'nation' WITH TAG 'nation2';    -- fail
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation4' WITH TAG 
'nation';
+COPY BINARY dir_table2 FROM PROGRAM :'cat_nation_file' 'nation5' WITH TAG 
'nation' WITH TAG 'nation2';    -- fail
 ERROR:  syntax error at or near "WITH"
 LINE 1: ...ress/data/nation.csv' 'nation5' WITH TAG 'nation' WITH TAG '...
                                                              ^
@@ -911,130 +916,135 @@ SELECT relative_path, content FROM 
directory_table('dir_table2') ORDER BY 1;
  nation4       | 
\x307c414c47455249417c307c20686167676c652e206361726566756c6c792066696e616c206465706f736974732064657465637420736c796c7920616761690a317c415247454e54494e417c317c616c20666f7865732070726f6d69736520736c796c79206163636f7264696e6720746f2074686520726567756c6172206163636f756e74732e20626f6c6420726571756573747320616c6f6e0a327c4252415a494c7c317c7920616c6f6e6773696465206f66207468652070656e64696e67206465706f736974732e206361726566756c6c79207370656369616c207061636b61676573206172652061626
 [...]
 (4 rows)
 
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation.txt';   -- 
OK
-NOTICE:  dir_table1 INSERT AFTER ROW
-COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation2.txt';   -- 
OK
-NOTICE:  dir_table1 INSERT AFTER ROW
-\COPY BINARY "abs.dir_table" FROM '@abs_srcdir@/data/nation.csv' 'aa.bb';    
-- OK
-COPY BINARY "abs.dir_table" FROM '@abs_srcdir@/data/nation.csv' 'cc.dd';    -- 
OK
+\COPY BINARY dir_table1 FROM :'nation_file' 'nation.txt';   -- OK
+ERROR:  syntax error at or near "'nation.txt'"
+LINE 1: COPY BINARY dir_table1 FROM STDIN 'nation_file' 'nation.txt'...
+                                                        ^
+COPY BINARY dir_table1 FROM :'nation_file' 'nation2.txt';   -- OK
+NOTICE:  dir_table1 INSERT AFTER ROW  (seg2 127.0.1.1:7004 pid=900444)
+\COPY BINARY "abs.dir_table" FROM :'nation_file' 'aa.bb';    -- OK
+ERROR:  syntax error at or near "'aa.bb'"
+LINE 1: ...Y BINARY "abs.dir_table" FROM STDIN 'nation_file' 'aa.bb';  ...
+                                                             ^
+COPY BINARY "abs.dir_table" FROM :'nation_file' 'cc.dd';    -- OK
 -- Test copy binary from directory table
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(format CSV);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (format CSV);
 ERROR:  conflicting or redundant options
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (format CSV...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (format CSV...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(freeze off);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze off);
 ERROR:  option "freeze" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (freeze off...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (freeze off...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(freeze on);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze on);
 ERROR:  option "freeze" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (freeze on)...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (freeze on)...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(delimiter ',');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (delimiter ',');
 ERROR:  option "delimiter" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (delimiter ...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (delimiter ...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(null ' ');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (null ' ');
 ERROR:  option "null" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (null ' ');
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (null ' ');
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(header off);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header off);
 ERROR:  option "header" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (header off...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (header off...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(header on);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header on);
 ERROR:  option "header" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (header on)...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (header on)...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(quote ':');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (quote ':');
 ERROR:  option "quote" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (quote ':')...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (quote ':')...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(escape ':');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (escape ':');
 ERROR:  option "escape" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (escape ':'...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (escape ':'...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_quote (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote (a));
 ERROR:  option "force_quote" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (force_quot...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_quot...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_quote *);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote *);
 ERROR:  option "force_quote" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (force_quot...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_quot...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_not_null (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_not_null 
(a));
 ERROR:  option "force_not_null" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (force_not_...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_not_...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_null (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_null (a));
 ERROR:  option "force_null" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (force_null...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_null...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(convert_selectively (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' 
(convert_selectively (a));
 ERROR:  option "convert_selectively" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (convert_se...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (convert_se...
                                                              ^
-\COPY BINARY dir_table1 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(encoding 'sql_ascii');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (encoding 
'sql_ascii');
 ERROR:  option "encoding" not recognized
-LINE 1: ...OPY BINARY dir_table1 FROM STDIN 'nation_failed' (encoding '...
+LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (encoding '...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(format CSV);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (format CSV);
 ERROR:  conflicting or redundant options
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (format CSV...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(freeze off);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (freeze off);
 ERROR:  option "freeze" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (freeze off...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(freeze on);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (freeze on);
 ERROR:  option "freeze" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (freeze on)...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(delimiter ',');
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (delimiter ',');
 ERROR:  option "delimiter" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (delimiter ...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(null ' ');
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (null ' ');
 ERROR:  option "null" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (null ' ');
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(header off);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (header off);
 ERROR:  option "header" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (header off...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(header on);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (header on);
 ERROR:  option "header" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (header on)...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(quote ':');
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (quote ':');
 ERROR:  option "quote" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (quote ':')...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(escape ':');
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (escape ':');
 ERROR:  option "escape" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (escape ':'...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_quote (a));
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (force_quote (a));
 ERROR:  option "force_quote" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_quot...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_quote *);
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (force_quote *);
 ERROR:  option "force_quote" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_quot...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_not_null (a));
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (force_not_null 
(a));
 ERROR:  option "force_not_null" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_not_...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(force_null (a));
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (force_null (a));
 ERROR:  option "force_null" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (force_null...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(convert_selectively (a));
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' 
(convert_selectively (a));
 ERROR:  option "convert_selectively" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (convert_se...
                                                              ^
-COPY BINARY dir_table2 FROM '@abs_srcdir@/data/nation.csv' 'nation_failed' 
(encoding 'sql_ascii');
+COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (encoding 
'sql_ascii');
 ERROR:  option "encoding" not recognized
 LINE 1: ...rc/test/regress/data/nation.csv' 'nation_failed' (encoding '...
                                                              ^
@@ -1094,31 +1104,36 @@ SELECT md5_equal('dir_table2', 'nation4');
 (1 row)
 
 -- Test Copy To directory table
-\COPY dir_table1 TO '@abs_srcdir@/data/dir_table1';  -- fail
+\set dir_table1_file :abs_srcdir '/data/dir_table1'
+\set dir_table12_file :abs_srcdir '/data/dir_table2'
+\set dir_nation1_file :abs_srcdir '/data/dir_nation1'
+\set dir_unknown_file :abs_srcdir '/data/dir_unknown'
+\set nation2_gz 'gzip -c -1 > ' :abs_srcdir '/data/nation2.gz'
+COPY dir_table1 TO :'dir_table1_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-\COPY BINARY dir_table1 TO '@abs_srcdir@/data/dir_table1';  -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-COPY dir_table1 TO '@abs_srcdir@/data/dir_table1';  -- fail
+COPY dir_table1 TO :'dir_table1_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-COPY BINARY dir_table1 TO '@abs_srcdir@/data/dir_table1';  -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-\COPY dir_table2 TO '@abs_srcdir@/data/dir_table2';  -- fail
+COPY dir_table2 TO :'dir_table12_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-\COPY BINARY dir_table2 TO '@abs_srcdir@/data/dir_table2';  -- fail
+COPY BINARY dir_table2 TO :'dir_table12_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-COPY dir_table2 TO '@abs_srcdir@/data/dir_table2';  -- fail
+COPY dir_table2 TO :'dir_table12_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-COPY BINARY dir_table2 TO '@abs_srcdir@/data/dir_table2';  -- fail
+COPY BINARY dir_table2 TO :'dir_table12_file';  -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-\COPY BINARY dir_table1 TO '@abs_srcdir@/data/dir_table1';   -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';   -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-COPY BINARY dir_table1 TO '@abs_srcdir@/data/dir_table1';   -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';   -- fail
 ERROR:  COPY to directory table must specify the relative_path name.
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO 
'@abs_srcdir@/data/nation1';   -- OK
-COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO 
'@abs_srcdir@/data/nation1';   -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO 
'@abs_srcdir@/data/unknown';   -- OK
-COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO 
'@abs_srcdir@/data/unknown';    -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdin; -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO :'dir_nation1_file';   -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO :'dir_nation1_file';   -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO :'dir_unknown_file';   -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO :'dir_unknown_file';    -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdin; -- OK
 0|ALGERIA|0| haggle. carefully final deposits detect slyly agai
 1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold 
requests alon
 2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are 
about the ironic forges. slyly special 
@@ -1170,7 +1185,7 @@ COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO 
stdin; -- OK
 22|RUSSIA|3| requests against the platelets use never according to the quickly 
regular pint
 23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. 
carefull
 24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent 
platelets breach ironic accounts. unusual pinto be
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdout; -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdout; -- OK
 0|ALGERIA|0| haggle. carefully final deposits detect slyly agai
 1|ARGENTINA|1|al foxes promise slyly according to the regular accounts. bold 
requests alon
 2|BRAZIL|1|y alongside of the pending deposits. carefully special packages are 
about the ironic forges. slyly special 
@@ -1222,14 +1237,20 @@ COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO 
stdout; -- OK
 22|RUSSIA|3| requests against the platelets use never according to the quickly 
regular pint
 23|UNITED KINGDOM|3|eans boost carefully special requests. accounts are. 
carefull
 24|UNITED STATES|1|y final packages. slow foxes cajole quickly. quickly silent 
platelets breach ironic accounts. unusual pinto be
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM 'gzip -c -1 > 
@abs_srcdir@/data/nation2.gz';   -- OK
-COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM 'gzip -c -1 > 
@abs_srcdir@/data/nation2.gz';   -- OK
-\COPY BINARY DIRECTORY TABLE "abs.dir_table" 'aa.bb' TO 
'@abs_srcdir@/data/aa.bb';   -- OK
-COPY BINARY DIRECTORY TABLE "abs.dir_table" 'cc.dd' TO 
'@abs_srcdir@/data/cc.dd';    -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation.txt' TO 
'@abs_srcdir@/data/nation.txt'; -- OK
-COPY BINARY DIRECTORY TABLE dir_table1 'nation2.txt' TO 
'@abs_srcdir@/data/nation2.txt'; -- OK
-\COPY BINARY DIRECTORY TABLE public.dir_table1 'nation.txt' TO 
'@abs_srcdir@/data/nation3.txt'; -- OK
-COPY BINARY DIRECTORY TABLE public.dir_table1 'nation2.txt' TO 
'@abs_srcdir@/data/nation4.txt'; -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM :'nation2_gz';   
-- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM :'nation2_gz';   
-- OK
+\set aa_bb_file :abs_srcdir '/data/aa.bb'
+\set cc_dd_file :abs_srcdir '/data/cc.dd'
+\set nation_txt_file :abs_srcdir '/data/nation.txt'
+\set nation2_txt_file :abs_srcdir '/data/nation2.txt'
+\set nation3_txt_file :abs_srcdir '/data/nation3.txt'
+\set nation4_txt_file :abs_srcdir '/data/nation4.txt'
+COPY BINARY DIRECTORY TABLE "abs.dir_table" 'aa.bb' TO :'aa_bb_file';   -- OK
+COPY BINARY DIRECTORY TABLE "abs.dir_table" 'cc.dd' TO :'cc_dd_file';    -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation.txt' TO :'nation_txt_file'; -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2.txt' TO :'nation2_txt_file'; 
-- OK
+COPY BINARY DIRECTORY TABLE public.dir_table1 'nation.txt' TO 
:'nation3_txt_file'; -- OK
+COPY BINARY DIRECTORY TABLE public.dir_table1 'nation2.txt' TO 
:'nation4_txt_file'; -- OK
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
  relative_path | size |  tag   
 ---------------+------+--------
@@ -1251,8 +1272,7 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER BY 
1;
  nation7       | 2199 | 
  nation8       | 2199 | 
  nation9       | 2199 | 
- nation.txt    | 2199 | 
-(19 rows)
+(18 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1403,8 +1423,7 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER BY 
1;
  nation7       | 2199 | 
  nation8       | 2199 | 
  nation9       | 2199 | 
- nation.txt    | 2199 | 
-(19 rows)
+(18 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1440,8 +1459,7 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER BY 
1;
  nation7       | 2199 | 
  nation8       | 2199 | 
  nation9       | 2199 | 
- nation.txt    | 2199 | 
-(19 rows)
+(18 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1534,8 +1552,7 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER BY 
1;
  nation7       | 2199 | nation_new_tag
  nation8       | 2199 | nation_new_tag
  nation9       | 2199 | nation_new_tag
- nation.txt    | 2199 | nation_new_tag
-(19 rows)
+(18 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |       tag       
@@ -1548,13 +1565,15 @@ SELECT relative_path, size, tag FROM dir_table2 ORDER 
BY 1;
 
 -- Test alter table directory schema table
 ALTER TABLE dir_table1 ADD COLUMN a int;    -- fail
-ERROR:  "dir_table1" is not a table, composite type, or foreign table
+ERROR:  ALTER action ADD COLUMN cannot be performed on relation "dir_table1"
+DETAIL:  This operation is not supported for partitioned indexes.
 ALTER DIRECTORY TABLE dir_table1 ADD COLUMN a int;  -- fail
 ERROR:  syntax error at or near "ADD"
 LINE 1: ALTER DIRECTORY TABLE dir_table1 ADD COLUMN a int;
                                          ^
 ALTER TABLE dir_table2 DROP COLUMN relative_path;   -- fail
-ERROR:  "dir_table2" is not a table, composite type, or foreign table
+ERROR:  ALTER action DROP COLUMN cannot be performed on relation "dir_table2"
+DETAIL:  This operation is not supported for partitioned indexes.
 ALTER DIRECTORY TABLE dir_table2 DROP COLUMN relative_path; -- fail
 ERROR:  syntax error at or near "DROP"
 LINE 1: ALTER DIRECTORY TABLE dir_table2 DROP COLUMN relative_path;
@@ -1566,7 +1585,8 @@ ERROR:  syntax error at or near "RENAME"
 LINE 1: ALTER DIRECTORY TABLE dir_table1 RENAME TO dir_table_new;
                                          ^
 ALTER TABLE dir_table2 ADD CONSTRAINT dirtable_constraint UNIQUE (tag); -- fail
-ERROR:  "dir_table2" is not a table or foreign table
+ERROR:  ALTER action ADD CONSTRAINT cannot be performed on relation 
"dir_table2"
+DETAIL:  This operation is not supported for partitioned indexes.
 ALTER DIRECTORY TABLE dir_table2 ADD CONSTRAINT dirtable_constraint UNIQUE 
(tag);   -- fail
 ERROR:  syntax error at or near "ADD"
 LINE 1: ALTER DIRECTORY TABLE dir_table2 ADD CONSTRAINT dirtable_con...
@@ -1640,8 +1660,7 @@ SELECT relative_path, size, tag FROM dir_table1 ORDER BY 
1;
  nation7       | 2199 | nation_new_tag
  nation8       | 2199 | nation_new_tag
  nation9       | 2199 | nation_new_tag
- nation.txt    | 2199 | nation_new_tag
-(17 rows)
+(16 rows)
 
 SELECT relative_path, size, tag FROM dir_table2 ORDER BY 1;
  relative_path | size |  tag   
@@ -1654,8 +1673,8 @@ SELECT relative_path, size, tag FROM dir_table2 ORDER BY 
1;
 -- Test transaction commit of directory table manipulation
 CREATE DIRECTORY TABLE dir_table4 TABLESPACE directory_tblspc;
 BEGIN;
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_commit';
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_commit2' 
WITH TAG 'nation';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_commit';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_commit2' WITH TAG 'nation';
 COMMIT;
 SELECT relative_path, content FROM directory_table('dir_table4') ORDER BY 1;
  relative_path  |                                                              
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
@@ -1701,7 +1720,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
 
 -- Test transaction rollback of directory table manipulation
 BEGIN;
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_rollback';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_rollback';
 SELECT relative_path, content FROM directory_table('dir_table4') ORDER BY 1;
   relative_path  |                                                             
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
              [...]
 
-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 [...]
@@ -1742,7 +1761,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_commit2 | nation_updated
 (1 row)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_rollback2' 
WITH TAG 'nation';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_rollback2' WITH TAG 
'nation';
 UPDATE dir_table4 SET tag = 'nation_updated' WHERE relative_path = 
'nation_rollback2';
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
   relative_path   |      tag       
@@ -1766,7 +1785,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_commit2 | nation_updated
 (1 row)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_subcommit' 
WITH TAG 'nation';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subcommit' WITH TAG 
'nation';
 SAVEPOINT s1;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
   relative_path   |      tag       
@@ -1775,7 +1794,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subcommit | nation
 (2 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_subcommit2';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subcommit2';
 SAVEPOINT s2;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
    relative_path   |      tag       
@@ -1785,7 +1804,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subcommit2 | 
 (3 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_subcommit3';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subcommit3';
 RELEASE SAVEPOINT s1;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
    relative_path   |      tag       
@@ -1831,7 +1850,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subcommit3 | 
 (3 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_subcommit';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subcommit';
 SAVEPOINT s2;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
    relative_path   |      tag       
@@ -1923,7 +1942,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subcommit3 | 
 (2 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 'nation_subcommit4';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subcommit4';
 SAVEPOINT s2;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
    relative_path   |      tag       
@@ -1936,8 +1955,8 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
 ROLLBACK TO SAVEPOINT s1;
 COMMIT;
 -- Test subtransaction rollback of directory table manipulation
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback1';
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback2';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback1';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback2';
 BEGIN;
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
     relative_path    |      tag       
@@ -1948,7 +1967,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subrollback2 | 
 (4 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback3';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback3';
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
     relative_path    |      tag       
 ---------------------+----------------
@@ -1978,7 +1997,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
 
 ROLLBACK;
 BEGIN;
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback4';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback4';
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
     relative_path    |      tag       
 ---------------------+----------------
@@ -2015,7 +2034,7 @@ SELECT remove_file('dir_table4', 'nation_subrollback2');
  t
 (1 row)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback5';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback5';
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
     relative_path    |      tag       
 ---------------------+----------------
@@ -2050,7 +2069,7 @@ SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
  nation_subrollback5 | 
 (4 rows)
 
-COPY BINARY dir_table4 FROM '@abs_srcdir@/data/nation.csv' 
'nation_subrollback6';
+COPY BINARY dir_table4 FROM :'nation_file' 'nation_subrollback6';
 SELECT relative_path, tag FROM dir_table4 ORDER BY 1;
     relative_path    |      tag       
 ---------------------+----------------
@@ -2136,5 +2155,5 @@ DROP TRIGGER IF EXISTS trigtest_b_stmt_tg_dirtable_1 ON 
dir_table1;
 NOTICE:  relation "dir_table1" does not exist, skipping
 DROP TRIGGER IF EXISTS trigtest_a_stmt_tg_dirtable_1 ON dir_table1;
 NOTICE:  relation "dir_table1" does not exist, skipping
-\!rm -rf @testtablespace@;
+\!rm -rf $PG_ABS_BUILDDIR/testtablespace;
 DROP TABLESPACE directory_tblspc;
diff --git a/src/test/regress/expected/external_table.out 
b/src/test/regress/expected/external_table.out
index 798a93d415b..38fbb3458de 100644
--- a/src/test/regress/expected/external_table.out
+++ b/src/test/regress/expected/external_table.out
@@ -2787,8 +2787,7 @@ SELECT COUNT(*) FROM 
gp_read_error_log('exttab_heap_join_1');
      2
 (1 row)
 
-\! rm @abs_srcdir@/data/tableless.csv
-rm: cannot remove '@abs_srcdir@/data/tableless.csv': No such file or directory
+\! rm $PG_ABS_SRCDIR/data/tableless.csv
 -- start_ignore
 DROP EXTERNAL TABLE IF EXISTS exttab_with_on_coordinator;
 NOTICE:  foreign table "exttab_with_on_coordinator" does not exist, skipping
diff --git a/src/test/regress/expected/external_table_persistent_error_log.out 
b/src/test/regress/expected/external_table_persistent_error_log.out
index b1fec1b38e8..b43f9df94a7 100644
--- a/src/test/regress/expected/external_table_persistent_error_log.out
+++ b/src/test/regress/expected/external_table_persistent_error_log.out
@@ -257,5 +257,4 @@ SELECT relname, linenum, errmsg FROM 
gp_read_persistent_error_log('ext_bytea');
 ---------+---------+--------
 (0 rows)
 
-\! rm @abs_srcdir@/data/tableerr.csv
-rm: cannot remove '@abs_srcdir@/data/tableerr.csv': No such file or directory
+\! rm $PG_ABS_SRCDIR/data/tableerr.csv
diff --git a/src/test/regress/sql/alter_db_set_tablespace.sql 
b/src/test/regress/sql/alter_db_set_tablespace.sql
index 39a0636d1be..68a0189955d 100644
--- a/src/test/regress/sql/alter_db_set_tablespace.sql
+++ b/src/test/regress/sql/alter_db_set_tablespace.sql
@@ -35,10 +35,7 @@ $$ LANGUAGE plpython3u;
 \set adst_source_tablespace_location :abs_builddir 
'/testtablespace/adst_source'
 \set adst_destination_tablespace_location :abs_builddir 
'/testtablespace/adst_dest'
 
-CREATE or REPLACE FUNCTION setup() RETURNS VOID AS $$
-DECLARE
-    adst_source_tablespace_location text := :'adst_source_tablespace_location';
-    adst_destination_tablespace_location text := 
:'adst_destination_tablespace_location';
+CREATE or REPLACE FUNCTION setup(adst_source_tablespace_location text, 
adst_destination_tablespace_location text) RETURNS VOID AS $$
 BEGIN
     -- Setup tablespace directories
     PERFORM 
setup_tablespace_location_dir_for_test(adst_source_tablespace_location);
@@ -167,7 +164,7 @@ $fn$;
 -- | M2      | deleted   | moved     | XLOG_XACT_COMMIT_PREPARED    |       |
 -- +---------+-----------+-----------+------------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -224,7 +221,7 @@ SELECT force_mirrors_to_catch_up();
 -- | SMaster | remains   | deleted   | XLOG_XACT_ABORT   |       |
 -- +---------+-----------+-----------+-------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -287,7 +284,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2      | remains   | deleted   | XLOG_XACT_ABORT   |       |
 -- +---------+-----------+-----------+-------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -357,7 +354,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2      | remains   | deleted   | XLOG_XACT_ABORT   |       |
 -- +---------+-----------+-----------+-------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -430,7 +427,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2      | remains   | deleted   | XLOG_XACT_ABORT_PREPARED |       |
 -- +---------+-----------+-----------+--------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -493,7 +490,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2      | remains   | deleted   | XLOG_XACT_ABORT_PREPARED |       |
 -- +---------+-----------+-----------+--------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -558,7 +555,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2      | remains   | deleted   | XLOG_XACT_ABORT_PREPARED |       |
 -- +---------+-----------+-----------+--------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -620,7 +617,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2          | remains   | deleted   | XLOG_XACT_ABORT_PREPARED |       |
 -- +-------------+-----------+-----------+--------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -688,7 +685,7 @@ SELECT force_mirrors_to_catch_up();
 -- | M2          | remains   | deleted   | XLOG_XACT_ABORT_PREPARED |       |
 -- +-------------+-----------+-----------+--------------------------+-------+
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Given we create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -773,7 +770,7 @@ show fsync;
 SELECT gp_wait_until_triggered_fault('ckpt_loop_begin', 1, mirror0());
 
 
-SELECT setup();
+SELECT setup(:'adst_source_tablespace_location', 
:'adst_destination_tablespace_location');
 -- Create the source and destination tablespaces
 CREATE TABLESPACE adst_source_tablespace LOCATION 
:'adst_source_tablespace_location';
 CREATE TABLESPACE adst_destination_tablespace LOCATION 
:'adst_destination_tablespace_location';
@@ -815,8 +812,9 @@ DROP SCHEMA adst CASCADE;
 
 SELECT gp_inject_fault('all', 'reset', dbid) FROM gp_segment_configuration;
 
-\!rm -rf @testtablespace@/adst_source
-\!rm -rf @testtablespace@/adst_dest
+
+\!rm -rf $PG_ABS_BUILDDIR/testtablespace/adst_source
+\!rm -rf $PG_ABS_BUILDDIR/testtablespace/adst_dest
 
 --- start_ignore
 -- Set fsync on because it is the value before the test
diff --git a/src/test/regress/sql/bb_memory_quota.sql 
b/src/test/regress/sql/bb_memory_quota.sql
index a624ff8306b..c68ae97a92f 100644
--- a/src/test/regress/sql/bb_memory_quota.sql
+++ b/src/test/regress/sql/bb_memory_quota.sql
@@ -10,10 +10,10 @@ alter resource queue memquota_resqueue1 with (memory_limit 
= '500MB');
 alter role memquota_role1 with resource queue memquota_resqueue1;
 
 -- concurrency = statement limit of the resource queue
-\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=4 
--dbname=regress --username=memquota_role1
+\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=4 
--dbname=regress --username=memquota_role1
 
 -- trigger query waiting
-\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=15 
--dbname=regress --username=memquota_role1
+\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=15 
--dbname=regress --username=memquota_role1
 
 -- use 'auto' memory allocation policy
 set gp_resqueue_memory_policy=auto;
diff --git a/src/test/regress/sql/directory_table.sql 
b/src/test/regress/sql/directory_table.sql
index 0a121831bb3..d79396d8d9b 100644
--- a/src/test/regress/sql/directory_table.sql
+++ b/src/test/regress/sql/directory_table.sql
@@ -311,31 +311,31 @@ SELECT relative_path, size, tag FROM dir_table2 ORDER BY 
1;
 
 \getenv abs_srcdir PG_ABS_SRCDIR
 \set nation_file :abs_srcdir '/data/nation.csv'
-\COPY dir_table1 FROM :'nation_file';    -- fail
-\COPY dir_table1 FROM :'nation_file' 'nation'; -- fail
-\COPY BINARY dir_table1 FROM :'nation_file';    -- fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation1';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation1'; -- fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation2' 'nation2'; -- fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation2';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';    -- 
fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation2';    
-- fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation4' WITH TAG 'nation';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation5' WITH TAG 'nation' WITH 
TAG 'nation2';    -- fail
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation6';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation7';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation8';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation9';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation10';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation11';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation12';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation13';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation14';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation15';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation16';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation17';
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation18';
+COPY dir_table1 FROM :'nation_file';    -- fail
+COPY dir_table1 FROM :'nation_file' 'nation'; -- fail
+COPY BINARY dir_table1 FROM :'nation_file';    -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation1';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation1'; -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation2' 'nation2'; -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation2';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation';    -- 
fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation3' WITH TAG 'nation2';    -- 
fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation4' WITH TAG 'nation';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation5' WITH TAG 'nation' WITH 
TAG 'nation2';    -- fail
+COPY BINARY dir_table1 FROM :'nation_file' 'nation6';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation7';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation8';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation9';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation10';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation11';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation12';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation13';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation14';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation15';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation16';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation17';
+COPY BINARY dir_table1 FROM :'nation_file' 'nation18';
 SELECT relative_path, size, tag FROM dir_table1 ORDER BY 1;
 SELECT relative_path, content FROM directory_table('dir_table1') ORDER BY 1;
 
@@ -359,21 +359,21 @@ COPY BINARY dir_table1 FROM :'nation_file' 'nation2.txt'; 
  -- OK
 COPY BINARY "abs.dir_table" FROM :'nation_file' 'cc.dd';    -- OK
 
 -- Test copy binary from directory table
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (format CSV);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze off);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze on);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (delimiter ',');
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (null ' ');
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header off);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header on);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (quote ':');
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (escape ':');
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote (a));
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote *);
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_not_null 
(a));
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_null (a));
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' 
(convert_selectively (a));
-\COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (encoding 
'sql_ascii');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (format CSV);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze off);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (freeze on);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (delimiter ',');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (null ' ');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header off);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (header on);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (quote ':');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (escape ':');
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_quote *);
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_not_null 
(a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (force_null (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' 
(convert_selectively (a));
+COPY BINARY dir_table1 FROM :'nation_file' 'nation_failed' (encoding 
'sql_ascii');
 
 COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (format CSV);
 COPY BINARY dir_table2 FROM :'nation_file' 'nation_failed' (freeze off);
@@ -417,25 +417,25 @@ SELECT md5_equal('dir_table2', 'nation4');
 \set dir_nation1_file :abs_srcdir '/data/dir_nation1'
 \set dir_unknown_file :abs_srcdir '/data/dir_unknown'
 \set nation2_gz 'gzip -c -1 > ' :abs_srcdir '/data/nation2.gz'
-\COPY dir_table1 TO :'dir_table1_file';  -- fail
-\COPY BINARY dir_table1 TO :'dir_table1_file';  -- fail
 COPY dir_table1 TO :'dir_table1_file';  -- fail
 COPY BINARY dir_table1 TO :'dir_table1_file';  -- fail
-\COPY dir_table2 TO :'dir_table12_file';  -- fail
-\COPY BINARY dir_table2 TO :'dir_table12_file';  -- fail
+COPY dir_table1 TO :'dir_table1_file';  -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';  -- fail
 COPY dir_table2 TO :'dir_table12_file';  -- fail
 COPY BINARY dir_table2 TO :'dir_table12_file';  -- fail
-\COPY BINARY dir_table1 TO :'dir_table1_file';   -- fail
+COPY dir_table2 TO :'dir_table12_file';  -- fail
+COPY BINARY dir_table2 TO :'dir_table12_file';  -- fail
+COPY BINARY dir_table1 TO :'dir_table1_file';   -- fail
 COPY BINARY dir_table1 TO :'dir_table1_file';   -- fail
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO :'dir_nation1_file';   -- 
OK
 COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO :'dir_nation1_file';   -- 
OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO :'dir_unknown_file';   -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation1' TO :'dir_nation1_file';   -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO :'dir_unknown_file';   -- 
OK
 COPY BINARY DIRECTORY TABLE dir_table1 'unknown' TO :'dir_unknown_file';    -- 
OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdin; -- OK
 COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdin; -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdout; -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdin; -- OK
 COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdout; -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM :'nation2_gz';   
-- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO stdout; -- OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM :'nation2_gz';   
-- OK
 COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO PROGRAM :'nation2_gz';   
-- OK
 
 \set aa_bb_file :abs_srcdir '/data/aa.bb'
@@ -444,11 +444,11 @@ COPY BINARY DIRECTORY TABLE dir_table1 'nation2' TO 
PROGRAM :'nation2_gz';   --
 \set nation2_txt_file :abs_srcdir '/data/nation2.txt'
 \set nation3_txt_file :abs_srcdir '/data/nation3.txt'
 \set nation4_txt_file :abs_srcdir '/data/nation4.txt'
-\COPY BINARY DIRECTORY TABLE "abs.dir_table" 'aa.bb' TO :'aa_bb_file';   -- OK
+COPY BINARY DIRECTORY TABLE "abs.dir_table" 'aa.bb' TO :'aa_bb_file';   -- OK
 COPY BINARY DIRECTORY TABLE "abs.dir_table" 'cc.dd' TO :'cc_dd_file';    -- OK
-\COPY BINARY DIRECTORY TABLE dir_table1 'nation.txt' TO :'nation_txt_file'; -- 
OK
+COPY BINARY DIRECTORY TABLE dir_table1 'nation.txt' TO :'nation_txt_file'; -- 
OK
 COPY BINARY DIRECTORY TABLE dir_table1 'nation2.txt' TO :'nation2_txt_file'; 
-- OK
-\COPY BINARY DIRECTORY TABLE public.dir_table1 'nation.txt' TO 
:'nation3_txt_file'; -- OK
+COPY BINARY DIRECTORY TABLE public.dir_table1 'nation.txt' TO 
:'nation3_txt_file'; -- OK
 COPY BINARY DIRECTORY TABLE public.dir_table1 'nation2.txt' TO 
:'nation4_txt_file'; -- OK
 
 
@@ -726,6 +726,6 @@ DROP TRIGGER IF EXISTS trigtest_a_row_tg_dirtable_1 ON 
dir_table1;
 DROP TRIGGER IF EXISTS trigtest_b_stmt_tg_dirtable_1 ON dir_table1;
 DROP TRIGGER IF EXISTS trigtest_a_stmt_tg_dirtable_1 ON dir_table1;
 
-\!rm -rf @testtablespace@;
+\!rm -rf $PG_ABS_BUILDDIR/testtablespace;
 
 DROP TABLESPACE directory_tblspc;
\ No newline at end of file
diff --git a/src/test/regress/sql/external_table.sql 
b/src/test/regress/sql/external_table.sql
index 7c9bfa1cdca..b8054a085d4 100644
--- a/src/test/regress/sql/external_table.sql
+++ b/src/test/regress/sql/external_table.sql
@@ -1416,7 +1416,7 @@ INSERT INTO test_ext_heap_join SELECT i, i || '_number' 
FROM generate_series(1,
 SELECT COUNT(*) FROM test_ext_heap_join, exttab_heap_join_1;
 SELECT COUNT(*) FROM gp_read_error_log('exttab_heap_join_1');
 
-\! rm @abs_srcdir@/data/tableless.csv
+\! rm $PG_ABS_SRCDIR/data/tableless.csv
 
 -- start_ignore
 DROP EXTERNAL TABLE IF EXISTS exttab_with_on_coordinator;
diff --git a/src/test/regress/sql/external_table_persistent_error_log.sql 
b/src/test/regress/sql/external_table_persistent_error_log.sql
index f1a8c3d268d..599efe542d0 100644
--- a/src/test/regress/sql/external_table_persistent_error_log.sql
+++ b/src/test/regress/sql/external_table_persistent_error_log.sql
@@ -110,4 +110,4 @@ SELECT gp_truncate_persistent_error_log('ext_bytea');
 SELECT relname, linenum, errmsg FROM gp_read_persistent_error_log('ext_bytea');
 
 
-\! rm @abs_srcdir@/data/tableerr.csv
+\! rm $PG_ABS_SRCDIR/data/tableerr.csv


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to