Skip to content

Commit 4279e5b

Browse files
committed
pg_amcheck: Message style and structuring improvements
1 parent 80a8f95 commit 4279e5b

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

src/bin/pg_amcheck/pg_amcheck.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,38 +1026,38 @@ verify_heap_slot_handler(PGresult *res, PGconn *conn, void *context)
10261026
msg = PQgetvalue(res, i, 3);
10271027

10281028
if (!PQgetisnull(res, i, 2))
1029-
printf(_("heap table \"%s\".\"%s\".\"%s\", block %s, offset %s, attribute %s:\n %s\n"),
1029+
printf(_("heap table \"%s.%s.%s\", block %s, offset %s, attribute %s:\n"),
10301030
rel->datinfo->datname, rel->nspname, rel->relname,
10311031
PQgetvalue(res, i, 0), /* blkno */
10321032
PQgetvalue(res, i, 1), /* offnum */
1033-
PQgetvalue(res, i, 2), /* attnum */
1034-
msg);
1033+
PQgetvalue(res, i, 2)); /* attnum */
10351034

10361035
else if (!PQgetisnull(res, i, 1))
1037-
printf(_("heap table \"%s\".\"%s\".\"%s\", block %s, offset %s:\n %s\n"),
1036+
printf(_("heap table \"%s.%s.%s\", block %s, offset %s:\n"),
10381037
rel->datinfo->datname, rel->nspname, rel->relname,
10391038
PQgetvalue(res, i, 0), /* blkno */
1040-
PQgetvalue(res, i, 1), /* offnum */
1041-
msg);
1039+
PQgetvalue(res, i, 1)); /* offnum */
10421040

10431041
else if (!PQgetisnull(res, i, 0))
1044-
printf(_("heap table \"%s\".\"%s\".\"%s\", block %s:\n %s\n"),
1042+
printf(_("heap table \"%s.%s.%s\", block %s:\n"),
10451043
rel->datinfo->datname, rel->nspname, rel->relname,
1046-
PQgetvalue(res, i, 0), /* blkno */
1047-
msg);
1044+
PQgetvalue(res, i, 0)); /* blkno */
10481045

10491046
else
1050-
printf(_("heap table \"%s\".\"%s\".\"%s\":\n %s\n"),
1051-
rel->datinfo->datname, rel->nspname, rel->relname, msg);
1047+
printf(_("heap table \"%s.%s.%s\":\n"),
1048+
rel->datinfo->datname, rel->nspname, rel->relname);
1049+
1050+
printf(" %s\n", msg);
10521051
}
10531052
}
10541053
else if (PQresultStatus(res) != PGRES_TUPLES_OK)
10551054
{
10561055
char *msg = indent_lines(PQerrorMessage(conn));
10571056

10581057
all_checks_pass = false;
1059-
printf(_("heap table \"%s\".\"%s\".\"%s\":\n%s"),
1060-
rel->datinfo->datname, rel->nspname, rel->relname, msg);
1058+
printf(_("heap table \"%s.%s.%s\":\n"),
1059+
rel->datinfo->datname, rel->nspname, rel->relname);
1060+
printf("%s", msg);
10611061
if (opts.verbose)
10621062
printf(_("query was: %s\n"), rel->sql);
10631063
FREE_AND_SET_NULL(msg);
@@ -1122,8 +1122,9 @@ verify_btree_slot_handler(PGresult *res, PGconn *conn, void *context)
11221122
char *msg = indent_lines(PQerrorMessage(conn));
11231123

11241124
all_checks_pass = false;
1125-
printf(_("btree index \"%s\".\"%s\".\"%s\":\n%s"),
1126-
rel->datinfo->datname, rel->nspname, rel->relname, msg);
1125+
printf(_("btree index \"%s.%s.%s\":\n"),
1126+
rel->datinfo->datname, rel->nspname, rel->relname);
1127+
printf("%s", msg);
11271128
if (opts.verbose)
11281129
printf(_("query was: %s\n"), rel->sql);
11291130
FREE_AND_SET_NULL(msg);

src/bin/pg_amcheck/t/004_verify_heapam.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,14 @@ sub header
327327
{
328328
my ($blkno, $offnum, $attnum) = @_;
329329
return
330-
qr/heap table "postgres"\."public"\."test", block $blkno, offset $offnum, attribute $attnum:\s+/ms
330+
qr/heap table "postgres\.public\.test", block $blkno, offset $offnum, attribute $attnum:\s+/ms
331331
if (defined $attnum);
332332
return
333-
qr/heap table "postgres"\."public"\."test", block $blkno, offset $offnum:\s+/ms
333+
qr/heap table "postgres\.public\.test", block $blkno, offset $offnum:\s+/ms
334334
if (defined $offnum);
335-
return qr/heap table "postgres"\."public"\."test", block $blkno:\s+/ms
335+
return qr/heap table "postgres\.public\.test", block $blkno:\s+/ms
336336
if (defined $blkno);
337-
return qr/heap table "postgres"\."public"\."test":\s+/ms;
337+
return qr/heap table "postgres\.public\.test":\s+/ms;
338338
}
339339

340340
# Corrupt the tuples, one type of corruption per tuple. Some types of

0 commit comments

Comments
 (0)