Re: Interval Question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Terry Lee Tucker <terry(at)esc1(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Interval Question
Date: 2005-01-11 18:19:20
Message-ID: 2653.1105467560@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Terry Lee Tucker <terry(at)esc1(dot)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);

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2005-01-11 18:29:59 Re: Limiting USAGE to only certain objects within a schema
Previous Message Nirmalya Lahiri 2005-01-11 18:16:16 Re: Private or publice function