Re: Timestamp/Interval proposals: Part 2 - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: Timestamp/Interval proposals: Part 2
Date
Msg-id 3D05F9AF.C40BFFFD@pgsql.com
Whole thread Raw
In response to Timestamp/Interval proposals: Part 2  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
> > fduch=> SELECT to_char('100days'::interval, 'YYYY-MM-DD HH24:MI:SS');
> > ---------------------
> >  0000-00-10 00:00:00
>  I already said it. The to_char() is 'tm' struct interpreter and use
>  standard internal PG routines for interval to 'tm' conversion. We can
>  talk about why 100days is converted to '10' days and months aren't
>  used. I agree this example seems strange. Thomas?

Not sure why 100 is becoming 10, except that the formatting string is
specifying a field width of two characters (right?). And for intervals,
years and months are not interchangable with days so values do not
overflow from days to months fields.

I played around with to_char(interval,text) but don't understand the
behavior either.
                    - Thomas


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: New string functions; initdb required
Next
From: Thomas Lockhart
Date:
Subject: Re: New string functions; initdb required