1
0
mirror of https://github.com/postgres/postgres.git synced 2026-01-05 23:38:41 +03:00

In messages, use singular nouns for -1, like we do for +1.

This outputs "-1 year", not "-1 years".

Reported-by: neverov.max@gmail.com

Bug: 16939

Discussion: https://postgr.es/m/16939-cceeb03fb72736ee@postgresql.org
This commit is contained in:
Bruce Momjian
2021-03-30 18:34:27 -04:00
parent 6131ffc43f
commit 5da9868ed9
4 changed files with 17 additions and 17 deletions

View File

@@ -694,7 +694,7 @@ AddVerboseIntPart(char *cp, int value, const char *units,
}
else if (*is_before)
value = -value;
sprintf(cp, " %d %s%s", value, units, (value == 1) ? "" : "s");
sprintf(cp, " %d %s%s", value, units, (abs(value) == 1) ? "" : "s");
*is_zero = false;
return cp + strlen(cp);
}
@@ -711,7 +711,7 @@ AddPostgresIntPart(char *cp, int value, const char *units,
(*is_before && value > 0) ? "+" : "",
value,
units,
(value != 1) ? "s" : "");
(abs(value) != 1) ? "s" : "");
/*
* Each nonzero field sets is_before for (only) the next one. This is a

View File

@@ -303,7 +303,7 @@ PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
}
if (po->header && !po->html3)
fprintf(fout, "(%d row%s)\n\n", PQntuples(res),
(PQntuples(res) == 1) ? "" : "s");
(abs(PQntuples(res)) == 1) ? "" : "s");
if (po->html3 && !po->expanded)
fputs("</table>\n", fout);
free(fieldMax);
@@ -662,7 +662,7 @@ PQdisplayTuples(const PGresult *res,
if (!quiet)
fprintf(fp, "\nQuery returned %d row%s.\n", PQntuples(res),
(PQntuples(res) == 1) ? "" : "s");
(abs(PQntuples(res)) == 1) ? "" : "s");
fflush(fp);