(MODULES-3804) Fix sort order of pg_hba_rule entries #1040
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
$order
-parameter topg_hba_rule
can be either an integer or astring, but the corresponding
concat
-resource is configured to sortthe entries using alphanumeric sort.
The result is that a
pg_hba_rule
entry withorder => 2
sorts afteran entry with
order => 10
.This is also a problem with the default
pg_hba_rule
entries, whichuses numeric order values 1, 2, 3, 4, 100 and 101. These are sorted in
the incorrect order (1, 100, 101, 2, 3, 4).
Unfortunately, since string values are allowed in the
$order
-parameter, we cannot simply change theconcat
-resource touse numeric sort.
This patch fixes this issue by zero-padding all integer values to
three digits. E.g. 1 becomes
001
, and 10 becomes010
. This shouldwork well for integer values from 0 through 999, and works well with
earlier versions of the module which used string values in that range
for the
$order
-parameter.