Skip to content
This repository was archived by the owner on Jul 6, 2021. It is now read-only.

Commit 05167b7

Browse files
committed
Merge branch 'dmius-l003-fix' into 'master'
Fix wrong rows data in L003 See merge request postgres-ai/postgres-checkup!319
2 parents adcf2f0 + fcd063a commit 05167b7

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

.ci/test_db_dump.sql

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,3 @@ CREATE TABLE test_schema."orders_A"
117117

118118
INSERT INTO test_schema."orders_A"(cnt) select id from generate_series(0, 100) _(id);
119119
SELECT setval('test_schema."orders_A_id_seq"'::regclass, 300000000, false);
120-
121-
122-
create table t_l003 (
123-
id integer primary key,
124-
name varchar(40)
125-
);
126-
insert into t_l003 (id, name) values(1920000000, 'test row');

pghrep/templates/L003.tpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Current database: {{ .database }}
99
### Master (`{{.hosts.master}}`) ###
1010
| Table | PK | Type | Current max value | ▼ Capacity used, % |
1111
|------|----|------|-------------------|-------------------------------|
12-
{{ range $i, $value := (index (index .results .hosts.master) "data") }}|`{{ index $value "Table"}}` | `{{ index $value "PK"}}` | {{ index $value "Type"}} | {{- RawIntFormat (index $value "Current max value")}} | {{ index $value "Capacity used, %"}}|
12+
{{ range $i, $key := (index (index (index .results .hosts.master) "data") "_keys") }}
13+
{{- $value := (index (index (index $.results $.hosts.master) "data") $key) -}}
14+
|`{{ index $value "Table"}}` | `{{ index $value "PK"}}` | {{ index $value "Type"}} | {{- RawIntFormat (index $value "Current max value")}} | {{ index $value "Capacity used, %"}}|
1315
{{ end }}
1416
{{- else -}}{{/*Master data*/}}
1517
Nothing found

resources/checks/L003_integer_in_pk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ SQL
7171
result=$(cat $f_stderr)
7272
result=${result:23:$((${#result}))}
7373

74-
echo "$result"
74+
echo "$result" | jq -cs 'sort_by(-(.[]."Capacity used, %"|tonumber)) | .[]' | jq -s add
7575

7676
rm -f "$f_stderr" "$f_stdout"

0 commit comments

Comments
 (0)