On Fri, 2005-03-25 at 15:33 -0500, Tom Lane wrote:
> Lyubomir Petrov <lpetrov(at)sysmaster(dot)com> writes:
> > I have found what is causing the crash described in Bug 1500. Now I
> > would like to fix it, but need opinions about what is the correct behaviour.
> Yeah, I just came to the same conclusion a little while ago:
> > Also the general to_char() Interval formatting seems broken anyway.
> Karel Zak has stated repeatedly that interval_to_char is fundamentally
> wrong and should be removed. I'm not sure it's quite as bad as that,
> but it does seem that a different set of formatting codes is needed for
> intervals as opposed to timestamps.
Exactly. We had many discussions about it. Well, short summary:
the current to_char(interval) is:
interval -> struct tm -> string
and it's definitely bad. You can't formatting interval as date/time
string and you can't use calendar practices in particular case.
The right solution is conversion:
interval -> interval-string
and it means definitely other (new) code for to_char(interval). I think
useful for to_char(interval) is only format parser from formatting.c,
it's 5% of all to_char() code :-(
I don't think we want to maintain useless code in PG and answer every
month in PG lists questions "why doesn't work it?". It's better remove
it and wait for someone who write better implementation.
BTW, I have started work on formatting library:
contributors, volunteers? :-)
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
In response to
pgsql-hackers by date
|Next:||From: Karel Zak||Date: 2005-03-26 01:32:46|
|Subject: Re: Bug 1500|
|Previous:||From: Tom Lane||Date: 2005-03-26 01:03:09|
|Subject: Re: Bug 1500 |