Skip to content

Commit 67ff4a8

Browse files
committed
Merge branch 'merge_concurrent' of github.com:postgrespro/pg_pathman into merge_concurrent
2 parents fe96482 + ed154fc commit 67ff4a8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/init.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ pathman_config_contains_relation(Oid relid, Datum *values, bool *isnull,
623623

624624
/*
625625
* Loads additional pathman parameters like 'enable_parent' or 'auto'
626+
* from PATHMAN_CONFIG_PARAMS
626627
*/
627628
bool
628629
read_pathman_params(Oid relid, Datum *values, bool *isnull)
@@ -632,7 +633,7 @@ read_pathman_params(Oid relid, Datum *values, bool *isnull)
632633
ScanKeyData key[1];
633634
Snapshot snapshot;
634635
HeapTuple htup;
635-
bool result = false;
636+
bool row_found = false;
636637

637638
ScanKeyInit(&key[0],
638639
Anum_pathman_config_params_partrel,
@@ -643,19 +644,20 @@ read_pathman_params(Oid relid, Datum *values, bool *isnull)
643644
snapshot = RegisterSnapshot(GetLatestSnapshot());
644645
scan = heap_beginscan(rel, snapshot, 1, key);
645646

647+
/* There should be just 1 row */
646648
if ((htup = heap_getnext(scan, ForwardScanDirection)) != NULL)
647649
{
648650
/* Extract data if necessary */
649651
heap_deform_tuple(htup, RelationGetDescr(rel), values, isnull);
650-
result = true;
652+
row_found = true;
651653
}
652654

653655
/* Clean resources */
654656
heap_endscan(scan);
655657
UnregisterSnapshot(snapshot);
656658
heap_close(rel, AccessShareLock);
657659

658-
return result;
660+
return row_found;
659661
}
660662

661663
/*

src/relation_info.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,18 @@ refresh_pathman_relation_info(Oid relid,
160160

161161
pfree(prel_children);
162162

163-
/*
164-
* Read additional parameters ('enable_parent' and 'auto' at the moment)
165-
*/
163+
/* Read additional parameters ('enable_parent' and 'auto' at the moment) */
166164
if (read_pathman_params(relid, param_values, param_isnull))
167165
{
168166
prel->enable_parent = param_values[Anum_pathman_config_params_enable_parent - 1];
169167
prel->auto_partition = param_values[Anum_pathman_config_params_auto - 1];
170168
}
169+
/* Else set default values if they cannot be found */
170+
else
171+
{
172+
prel->enable_parent = false;
173+
prel->auto_partition = true;
174+
}
171175

172176
/* We've successfully built a cache entry */
173177
prel->valid = true;

0 commit comments

Comments
 (0)