Re: Interval Question - Mailing list pgsql-general

From Tom Lane
Subject Re: Interval Question
Date
Msg-id 2653.1105467560@sss.pgh.pa.us
Whole thread Raw
In response to Re: Interval Question  (Terry Lee Tucker <terry@esc1.com>)
Responses Re: Interval Question
List pgsql-general
Terry Lee Tucker <terry@esc1.com> writes:
> Apparently, if DateStyle is set to Sql, it always returns the absolute value.
> Is this due to some Sql standard or is it a bug?

It's a bug in interval_out.  Looks like it gets it wrong for GERMAN
style too.  Surprising no one noticed before.

(In any case, I dunno why you are parsing the textual output to discover
whether an interval is negative...)

            regards, tom lane

Soon-to-be-applied patch:

*** src/backend/utils/adt/datetime.c.orig    Fri Dec 31 17:46:13 2004
--- src/backend/utils/adt/datetime.c    Tue Jan 11 13:13:30 2005
***************
*** 3932,3938 ****
          cp += strlen(cp);
      }

!     if (is_before && (style == USE_POSTGRES_DATES))
      {
          strcat(cp, " ago");
          cp += strlen(cp);
--- 3932,3938 ----
          cp += strlen(cp);
      }

!     if (is_before && (style != USE_ISO_DATES))
      {
          strcat(cp, " ago");
          cp += strlen(cp);

pgsql-general by date:

Previous
From: Nirmalya Lahiri
Date:
Subject: Re: Private or publice function
Next
From: Geoffrey
Date:
Subject: Re: Interval Question