From: Tom Lane Date: Tue, 11 Jan 2005 18:34:01 +0000 (+0000) Subject: interval_out failed to mention 'ago' for negative intervals in SQL and X-Git-Tag: REL7_4_7~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c8b52bf8b7144b509462e8f33f9c0af9d93f980;p=postgresql interval_out failed to mention 'ago' for negative intervals in SQL and GERMAN datestyles. Ancient bug reported by Terry Lee Tucker. --- diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index aa369cc59b..fb01c7d30f 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.118.2.3 2004/06/13 17:17:48 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.118.2.4 2005/01/11 18:33:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3907,7 +3907,7 @@ EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str) cp += strlen(cp); } - if (is_before && (style == USE_POSTGRES_DATES)) + if (is_before && (style != USE_ISO_DATES)) { strcat(cp, " ago"); cp += strlen(cp); diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index e1d34e8a7b..7a06069634 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -663,7 +663,7 @@ EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str) cp += strlen(cp); } - if (is_before && (style == USE_POSTGRES_DATES)) + if (is_before && (style != USE_ISO_DATES)) { strcat(cp, " ago"); cp += strlen(cp);