Skip to content

Commit 180cce2

Browse files
committed
Fix directory table
1 parent b4cde09 commit 180cce2

File tree

13 files changed

+262
-240
lines changed

13 files changed

+262
-240
lines changed

src/backend/catalog/pg_class.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ errdetail_relkind_not_supported(char relkind)
4545
return errdetail("This operation is not supported for partitioned tables.");
4646
case RELKIND_PARTITIONED_INDEX:
4747
return errdetail("This operation is not supported for partitioned indexes.");
48+
case RELKIND_DIRECTORY_TABLE:
49+
return errdetail("This operation is not supported for partitioned indexes.");
4850
default:
4951
elog(ERROR, "unrecognized relkind: '%c'", relkind);
5052
return 0;

src/backend/commands/copyfrom.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,9 @@ BeginCopyFromDirectoryTable(ParseState *pstate,
15671567

15681568
num_phys_attrs = tupDesc->natts;
15691569

1570+
cstate->defaults = (bool *) palloc0(tupDesc->natts * sizeof(bool));
1571+
cstate->num_defaults = tupDesc->natts;
1572+
15701573
cstate->attnumlist = CopyGetAttnums(tupDesc, cstate->rel, NIL);
15711574

15721575
/*

src/backend/optimizer/util/plancat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
151151
if (!relation->rd_tableam)
152152
{
153153
if (!(relation->rd_rel->relkind == RELKIND_FOREIGN_TABLE ||
154+
relation->rd_rel->relkind == RELKIND_DIRECTORY_TABLE ||
154155
relation->rd_rel->relkind == RELKIND_PARTITIONED_TABLE))
155156
ereport(ERROR,
156157
(errcode(ERRCODE_WRONG_OBJECT_TYPE),

src/include/catalog/pg_class.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ DECLARE_INDEX(pg_class_tblspc_relfilenode_index, 3455, ClassTblspcRelfilenodeInd
245245
*/
246246
#define RELKIND_HAS_TABLE_AM(relkind) \
247247
((relkind) == RELKIND_RELATION || \
248+
(relkind) == RELKIND_DIRECTORY_TABLE || \
248249
(relkind) == RELKIND_TOASTVALUE || \
249250
(relkind) == RELKIND_AOSEGMENTS || \
250251
(relkind) == RELKIND_AOBLOCKDIR || \

src/test/regress/expected/bb_memory_quota.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ create resource queue memquota_resqueue1 active threshold 4;
55
alter resource queue memquota_resqueue1 with (memory_limit = '500MB');
66
alter role memquota_role1 with resource queue memquota_resqueue1;
77
-- concurrency = statement limit of the resource queue
8-
\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=4 --dbname=regress --username=memquota_role1
8+
\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=4 --dbname=regress --username=memquota_role1
99
-- trigger query waiting
10-
\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=15 --dbname=regress --username=memquota_role1
10+
\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=15 --dbname=regress --username=memquota_role1
1111
-- use 'auto' memory allocation policy
1212
set gp_resqueue_memory_policy=auto;
1313
(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);

src/test/regress/expected/directory_table.out

Lines changed: 179 additions & 160 deletions
Large diffs are not rendered by default.

src/test/regress/expected/external_table.out

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2787,8 +2787,7 @@ SELECT COUNT(*) FROM gp_read_error_log('exttab_heap_join_1');
27872787
2
27882788
(1 row)
27892789

2790-
\! rm @abs_srcdir@/data/tableless.csv
2791-
rm: cannot remove '@abs_srcdir@/data/tableless.csv': No such file or directory
2790+
\! rm $PG_ABS_SRCDIR/data/tableless.csv
27922791
-- start_ignore
27932792
DROP EXTERNAL TABLE IF EXISTS exttab_with_on_coordinator;
27942793
NOTICE: foreign table "exttab_with_on_coordinator" does not exist, skipping

src/test/regress/expected/external_table_persistent_error_log.out

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,5 +257,4 @@ SELECT relname, linenum, errmsg FROM gp_read_persistent_error_log('ext_bytea');
257257
---------+---------+--------
258258
(0 rows)
259259

260-
\! rm @abs_srcdir@/data/tableerr.csv
261-
rm: cannot remove '@abs_srcdir@/data/tableerr.csv': No such file or directory
260+
\! rm $PG_ABS_SRCDIR/data/tableerr.csv

src/test/regress/sql/alter_db_set_tablespace.sql

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ $$ LANGUAGE plpython3u;
3535
\set adst_source_tablespace_location :abs_builddir '/testtablespace/adst_source'
3636
\set adst_destination_tablespace_location :abs_builddir '/testtablespace/adst_dest'
3737

38-
CREATE or REPLACE FUNCTION setup() RETURNS VOID AS $$
39-
DECLARE
40-
adst_source_tablespace_location text := :'adst_source_tablespace_location';
41-
adst_destination_tablespace_location text := :'adst_destination_tablespace_location';
38+
CREATE or REPLACE FUNCTION setup(adst_source_tablespace_location text, adst_destination_tablespace_location text) RETURNS VOID AS $$
4239
BEGIN
4340
-- Setup tablespace directories
4441
PERFORM setup_tablespace_location_dir_for_test(adst_source_tablespace_location);
@@ -167,7 +164,7 @@ $fn$;
167164
-- | M2 | deleted | moved | XLOG_XACT_COMMIT_PREPARED | |
168165
-- +---------+-----------+-----------+------------------------------+-------+
169166

170-
SELECT setup();
167+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
171168
-- Given we create the source and destination tablespaces
172169
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
173170
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -224,7 +221,7 @@ SELECT force_mirrors_to_catch_up();
224221
-- | SMaster | remains | deleted | XLOG_XACT_ABORT | |
225222
-- +---------+-----------+-----------+-------------------+-------+
226223

227-
SELECT setup();
224+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
228225
-- Given we create the source and destination tablespaces
229226
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
230227
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -287,7 +284,7 @@ SELECT force_mirrors_to_catch_up();
287284
-- | M2 | remains | deleted | XLOG_XACT_ABORT | |
288285
-- +---------+-----------+-----------+-------------------+-------+
289286

290-
SELECT setup();
287+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
291288
-- Given we create the source and destination tablespaces
292289
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
293290
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -357,7 +354,7 @@ SELECT force_mirrors_to_catch_up();
357354
-- | M2 | remains | deleted | XLOG_XACT_ABORT | |
358355
-- +---------+-----------+-----------+-------------------+-------+
359356

360-
SELECT setup();
357+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
361358
-- Given we create the source and destination tablespaces
362359
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
363360
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -430,7 +427,7 @@ SELECT force_mirrors_to_catch_up();
430427
-- | M2 | remains | deleted | XLOG_XACT_ABORT_PREPARED | |
431428
-- +---------+-----------+-----------+--------------------------+-------+
432429

433-
SELECT setup();
430+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
434431
-- Given we create the source and destination tablespaces
435432
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
436433
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -493,7 +490,7 @@ SELECT force_mirrors_to_catch_up();
493490
-- | M2 | remains | deleted | XLOG_XACT_ABORT_PREPARED | |
494491
-- +---------+-----------+-----------+--------------------------+-------+
495492

496-
SELECT setup();
493+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
497494
-- Given we create the source and destination tablespaces
498495
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
499496
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -558,7 +555,7 @@ SELECT force_mirrors_to_catch_up();
558555
-- | M2 | remains | deleted | XLOG_XACT_ABORT_PREPARED | |
559556
-- +---------+-----------+-----------+--------------------------+-------+
560557

561-
SELECT setup();
558+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
562559
-- Given we create the source and destination tablespaces
563560
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
564561
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -620,7 +617,7 @@ SELECT force_mirrors_to_catch_up();
620617
-- | M2 | remains | deleted | XLOG_XACT_ABORT_PREPARED | |
621618
-- +-------------+-----------+-----------+--------------------------+-------+
622619

623-
SELECT setup();
620+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
624621
-- Given we create the source and destination tablespaces
625622
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
626623
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -688,7 +685,7 @@ SELECT force_mirrors_to_catch_up();
688685
-- | M2 | remains | deleted | XLOG_XACT_ABORT_PREPARED | |
689686
-- +-------------+-----------+-----------+--------------------------+-------+
690687

691-
SELECT setup();
688+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
692689
-- Given we create the source and destination tablespaces
693690
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
694691
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -773,7 +770,7 @@ show fsync;
773770
SELECT gp_wait_until_triggered_fault('ckpt_loop_begin', 1, mirror0());
774771

775772

776-
SELECT setup();
773+
SELECT setup(:'adst_source_tablespace_location', :'adst_destination_tablespace_location');
777774
-- Create the source and destination tablespaces
778775
CREATE TABLESPACE adst_source_tablespace LOCATION :'adst_source_tablespace_location';
779776
CREATE TABLESPACE adst_destination_tablespace LOCATION :'adst_destination_tablespace_location';
@@ -815,8 +812,9 @@ DROP SCHEMA adst CASCADE;
815812

816813
SELECT gp_inject_fault('all', 'reset', dbid) FROM gp_segment_configuration;
817814

818-
\!rm -rf @testtablespace@/adst_source
819-
\!rm -rf @testtablespace@/adst_dest
815+
816+
\!rm -rf $PG_ABS_BUILDDIR/testtablespace/adst_source
817+
\!rm -rf $PG_ABS_BUILDDIR/testtablespace/adst_dest
820818

821819
--- start_ignore
822820
-- Set fsync on because it is the value before the test

src/test/regress/sql/bb_memory_quota.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ alter resource queue memquota_resqueue1 with (memory_limit = '500MB');
1010
alter role memquota_role1 with resource queue memquota_resqueue1;
1111

1212
-- concurrency = statement limit of the resource queue
13-
\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=4 --dbname=regress --username=memquota_role1
13+
\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=4 --dbname=regress --username=memquota_role1
1414

1515
-- trigger query waiting
16-
\! @abs_builddir@/mem_quota_util.py --complexity=1 --concurrency=15 --dbname=regress --username=memquota_role1
16+
\! $PG_ABS_BUILDDIR/mem_quota_util.py --complexity=1 --concurrency=15 --dbname=regress --username=memquota_role1
1717

1818
-- use 'auto' memory allocation policy
1919
set gp_resqueue_memory_policy=auto;

0 commit comments

Comments
 (0)