Skip site navigation (1) Skip section navigation (2)

Re: Bug 1500

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lyubomir Petrov <lpetrov(at)sysmaster(dot)com>,List pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Bug 1500
Date: 2005-03-26 01:18:40
Message-ID: 1111799920.2388.61.camel@petra (view raw or flat)
Thread:
Lists: pgsql-hackers
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:
> http://archives.postgresql.org/pgsql-hackers/2005-03/msg00908.php
> 
> > 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:

     http://people.redhat.com/kzak/libfmt/ 

contributors, volunteers? :-)

	Karel

-- 
Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>


In response to

pgsql-hackers by date

Next:From: Karel ZakDate: 2005-03-26 01:32:46
Subject: Re: Bug 1500
Previous:From: Tom LaneDate: 2005-03-26 01:03:09
Subject: Re: Bug 1500

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group