aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/ecpg/pgtypeslib/interval.c5
-rw-r--r--src/interfaces/libpq/fe-print.c4
2 files changed, 5 insertions, 4 deletions
diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c
index 4245016c8e8..02b3c472233 100644
--- a/src/interfaces/ecpg/pgtypeslib/interval.c
+++ b/src/interfaces/ecpg/pgtypeslib/interval.c
@@ -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, (abs(value) == 1) ? "" : "s");
+ sprintf(cp, " %d %s%s", value, units, (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,
- (abs(value) != 1) ? "s" : "");
+ (value != 1) ? "s" : "");
/*
* Each nonzero field sets is_before for (only) the next one. This is a
@@ -924,6 +924,7 @@ EncodeInterval(struct /* pg_ */ tm *tm, fsec_t fsec, int style, char *str)
*cp++ = '-';
AppendSeconds(cp, sec, fsec, MAX_INTERVAL_PRECISION, false);
cp += strlen(cp);
+ /* We output "ago", not negatives, so use abs(). */
sprintf(cp, " sec%s",
(abs(sec) != 1 || fsec != 0) ? "s" : "");
is_zero = false;
diff --git a/src/interfaces/libpq/fe-print.c b/src/interfaces/libpq/fe-print.c
index af19b3c0a3e..94219b1825b 100644
--- a/src/interfaces/libpq/fe-print.c
+++ b/src/interfaces/libpq/fe-print.c
@@ -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),
- (abs(PQntuples(res)) == 1) ? "" : "s");
+ (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),
- (abs(PQntuples(res)) == 1) ? "" : "s");
+ (PQntuples(res) == 1) ? "" : "s");
fflush(fp);