Skip to content

Commit e546d1d

Browse files
committed
pg_amcheck: Message style and structuring improvements
1 parent a945f55 commit e546d1d

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
@@ -1028,38 +1028,38 @@ verify_heap_slot_handler(PGresult *res, PGconn *conn, void *context)
10281028
msg = PQgetvalue(res, i, 3);
10291029

10301030
if (!PQgetisnull(res, i, 2))
1031-
printf(_("heap table \"%s\".\"%s\".\"%s\", block %s, offset %s, attribute %s:\n %s\n"),
1031+
printf(_("heap table \"%s.%s.%s\", block %s, offset %s, attribute %s:\n"),
10321032
rel->datinfo->datname, rel->nspname, rel->relname,
10331033
PQgetvalue(res, i, 0), /* blkno */
10341034
PQgetvalue(res, i, 1), /* offnum */
1035-
PQgetvalue(res, i, 2), /* attnum */
1036-
msg);
1035+
PQgetvalue(res, i, 2)); /* attnum */
10371036

10381037
else if (!PQgetisnull(res, i, 1))
1039-
printf(_("heap table \"%s\".\"%s\".\"%s\", block %s, offset %s:\n %s\n"),
1038+
printf(_("heap table \"%s.%s.%s\", block %s, offset %s:\n"),
10401039
rel->datinfo->datname, rel->nspname, rel->relname,
10411040
PQgetvalue(res, i, 0), /* blkno */
1042-
PQgetvalue(res, i, 1), /* offnum */
1043-
msg);
1041+
PQgetvalue(res, i, 1)); /* offnum */
10441042

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

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

10601059
all_checks_pass = false;
1061-
printf(_("heap table \"%s\".\"%s\".\"%s\":\n%s"),
1062-
rel->datinfo->datname, rel->nspname, rel->relname, msg);
1060+
printf(_("heap table \"%s.%s.%s\":\n"),
1061+
rel->datinfo->datname, rel->nspname, rel->relname);
1062+
printf("%s", msg);
10631063
if (opts.verbose)
10641064
printf(_("query was: %s\n"), rel->sql);
10651065
FREE_AND_SET_NULL(msg);
@@ -1124,8 +1124,9 @@ verify_btree_slot_handler(PGresult *res, PGconn *conn, void *context)
11241124
char *msg = indent_lines(PQerrorMessage(conn));
11251125

11261126
all_checks_pass = false;
1127-
printf(_("btree index \"%s\".\"%s\".\"%s\":\n%s"),
1128-
rel->datinfo->datname, rel->nspname, rel->relname, msg);
1127+
printf(_("btree index \"%s.%s.%s\":\n"),
1128+
rel->datinfo->datname, rel->nspname, rel->relname);
1129+
printf("%s", msg);
11291130
if (opts.verbose)
11301131
printf(_("query was: %s\n"), rel->sql);
11311132
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)