Skip to content

Commit ed154fc

Browse files
committed
fixes regarding PATHMAN_CONFIG_PARAMS in refresh_pathman_relation_info()
1 parent dbcce6e commit ed154fc

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

src/init.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ pathman_config_contains_relation(Oid relid, Datum *values, bool *isnull,
622622
}
623623

624624
/*
625-
* Return 'enable_parent' parameter of relation
625+
* Return additional parameters from PATHMAN_CONFIG_PARAMS.
626626
*/
627627
bool
628628
read_pathman_params(Oid relid, Datum *values, bool *isnull)
@@ -632,7 +632,7 @@ read_pathman_params(Oid relid, Datum *values, bool *isnull)
632632
ScanKeyData key[1];
633633
Snapshot snapshot;
634634
HeapTuple htup;
635-
bool result = false;
635+
bool row_found = false;
636636

637637
ScanKeyInit(&key[0],
638638
Anum_pathman_config_params_partrel,
@@ -643,19 +643,20 @@ read_pathman_params(Oid relid, Datum *values, bool *isnull)
643643
snapshot = RegisterSnapshot(GetLatestSnapshot());
644644
scan = heap_beginscan(rel, snapshot, 1, key);
645645

646+
/* There should be just 1 row */
646647
if ((htup = heap_getnext(scan, ForwardScanDirection)) != NULL)
647648
{
648649
/* Extract data if necessary */
649650
heap_deform_tuple(htup, RelationGetDescr(rel), values, isnull);
650-
result = true;
651+
row_found = true;
651652
}
652653

653654
/* Clean resources */
654655
heap_endscan(scan);
655656
UnregisterSnapshot(snapshot);
656657
heap_close(rel, AccessShareLock);
657658

658-
return result;
659+
return row_found;
659660
}
660661

661662
/*

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy