1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Add replacement for linefeeds in monitoring example.

The copy command was converting \n to a linefeed, which the json conversion did not like. In a healthy repository there won't be any linefeeds but certain errors can contain them.

Fix by loading into a text field and then replacing the linefeed when converting to jsonb.
This commit is contained in:
David Steele 2022-12-27 20:28:38 +07:00 committed by GitHub
parent 44da314adb
commit ae258f604e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 2 deletions

View File

@ -13,14 +13,14 @@ declare
data jsonb;
begin
-- Create a temp table to hold the JSON data
create temp table temp_pgbackrest_data (data jsonb);
create temp table temp_pgbackrest_data (data text);
-- Copy data into the table directly from the pgBackRest info command
copy temp_pgbackrest_data (data)
from program
'pgbackrest --output=json info' (format text);
select temp_pgbackrest_data.data
select replace(temp_pgbackrest_data.data, E'\n', '\n')::jsonb
into data
from temp_pgbackrest_data;

View File

@ -65,6 +65,25 @@
</release-item>
</release-development-list>
</release-core-list>
<release-doc-list>
<release-improvement-list>
<release-item>
<github-issue id="1910"/>
<github-pull-request id="1963"/>
<release-item-contributor-list>
<release-item-ideator id="rudonx"/>
<release-item-ideator id="gmustdie"/>
<release-item-ideator id="ivan.shelestov"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stefan.fercot"/>
</release-item-contributor-list>
<p>Add replacement for linefeeds in monitoring example.</p>
</release-item>
</release-improvement-list>
</release-doc-list>
</release>
<release date="2022-11-28" version="2.43" title="Bug Fix">
@ -12066,6 +12085,11 @@
<contributor-id type="github">gkleen</contributor-id>
</contributor>
<contributor id="gmustdie">
<contributor-name-display>gmustdie</contributor-name-display>
<contributor-id type="github">gmustdie</contributor-id>
</contributor>
<contributor id="greg.sabino.mullane">
<contributor-name-display>Greg Sabino Mullane</contributor-name-display>
<contributor-id type="github">turnstep</contributor-id>
@ -12110,6 +12134,11 @@
<contributor-id type="github">Isaacwhyuenac</contributor-id>
</contributor>
<contributor id="ivan.shelestov">
<contributor-name-display>Ivan Shelestov</contributor-name-display>
<contributor-id type="github">Shelestov7</contributor-id>
</contributor>
<contributor id="reid.thompson">
<contributor-name-display>Reid Thompson</contributor-name-display>
<contributor-id type="github">jreidthompson</contributor-id>
@ -12498,6 +12527,11 @@
<contributor-id type="github">rdunklau</contributor-id>
</contributor>
<contributor id="rudonx">
<contributor-name-display>rudonx</contributor-name-display>
<contributor-id type="github">rudonx</contributor-id>
</contributor>
<contributor id="ryan.lambert">
<contributor-name-display>Ryan Lambert</contributor-name-display>
<contributor-id type="github">rustprooflabs</contributor-id>