Re: [HACKERS] Bug 1500

2005-03-27 Thread Karel Zak
On Sat, 2005-03-26 at 15:56 -0800, Josh Berkus wrote: Alvaro, On Sat, Mar 26, 2005 at 02:04:14PM -0800, Josh Berkus wrote: SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI' ) || ' min'; 2600 min Hmm, what if you wanted more than one literal string? Say 1 mon 3 days ... your

Re: [HACKERS] Bug 1500

2005-03-27 Thread Karel Zak
On Sun, 2005-03-27 at 12:03 +0200, Karel Zak wrote: On Sat, 2005-03-26 at 15:56 -0800, Josh Berkus wrote: Alvaro, On Sat, Mar 26, 2005 at 02:04:14PM -0800, Josh Berkus wrote: SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI' ) || ' min'; 2600 min Hmm, what if you wanted

Re: [HACKERS] Bug 1500

2005-03-27 Thread Tom Lane
Karel Zak [EMAIL PROTECTED] writes: Hmm, if we want to support conversion like: '43 hours 20 minutes' -- 'MI min' how we should work with calendar INTERVAL units? For example 'month'? '1 month 1 day' -- 'D days' I think answer should be error message: missing calendar unit 'month'

Re: [HACKERS] Bug 1500

2005-03-27 Thread Josh Berkus
Tom, Karel, Hmm, if we want to support conversion like: '43 hours 20 minutes' -- 'MI min' how we should work with calendar INTERVAL units? For example 'month'? '1 month 1 day' -- 'D days' I think answer should be error message: missing calendar unit 'month' in output format Actually,

Re: [HACKERS] Bug 1500

2005-03-26 Thread Josh Berkus
Karel, Yeah. Karel Zak, who wrote that code, is convinced we should remove it, but I don't think anyone else is ... I think I was Peter and Josh Berkus who convinced me that the code is bed. we should remove... is opinion only... I certainly didn't recommend removing it before we have a

Re: [HACKERS] Bug 1500

2005-03-26 Thread lsunley
This has my vote Lorne In [EMAIL PROTECTED], on 03/26/05 at 02:04 PM, Josh Berkus josh@agliodbs.com said: Karel, Yeah. áKarel Zak, who wrote that code, is convinced we should remove it, but I don't think anyone else is ... áI think I was Peter and Josh Berkus who convinced me

Re: [HACKERS] Bug 1500

2005-03-26 Thread Alvaro Herrera
On Sat, Mar 26, 2005 at 02:04:14PM -0800, Josh Berkus wrote: SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI' ) || ' min'; 2600 min Hmm, what if you wanted more than one literal string? Say 1 mon 3 days ... your concatenation idea wouldn't work. ISTM the format string should allow

Re: [HACKERS] Bug 1500

2005-03-26 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: ... ISTM the format string should allow unconverted literals, so you would use SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI min' ); ... which to_char can do already, IIRC. The rewrite should define a new set of format substitution codes, but

Re: [HACKERS] Bug 1500

2005-03-26 Thread Josh Berkus
Alvaro, On Sat, Mar 26, 2005 at 02:04:14PM -0800, Josh Berkus wrote: SELECT to_char( INTERVAL '43 hours 20 minutes', 'MI' ) || ' min'; 2600 min Hmm, what if you wanted more than one literal string? Say 1 mon 3 days ... your concatenation idea wouldn't work. ISTM the format string

[HACKERS] Bug 1500

2005-03-25 Thread Lyubomir Petrov
Hi, 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. The bug can be easily duplicated when formatting interval in to_char() using 'Mon' or 'Month' in the format string. select to_char(now() -

Re: [HACKERS] Bug 1500

2005-03-25 Thread Tom Lane
Lyubomir Petrov [EMAIL PROTECTED] 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:

Re: [HACKERS] Bug 1500

2005-03-25 Thread Steve Crawford
So this bug actually brings the issue of interval to_char() formatting. Opinions? In digging around I discovered that it appears a decision was made to remove to_char(interval) at the 8.1 release but I've been unable to find the replacement for this functionality. This alarms me. Given the

Re: [HACKERS] Bug 1500

2005-03-25 Thread Lyubomir Petrov
Steve Crawford wrote: So this bug actually brings the issue of interval to_char() formatting. Opinions? In digging around I discovered that it appears a decision was made to remove to_char(interval) at the 8.1 release but I've been unable to find the replacement for this functionality. This

Re: [HACKERS] Bug 1500

2005-03-25 Thread Lyubomir Petrov
Tom Lane wrote: Lyubomir Petrov [EMAIL PROTECTED] 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:

Re: [HACKERS] Bug 1500

2005-03-25 Thread Tom Lane
Steve Crawford [EMAIL PROTECTED] writes: In digging around I discovered that it appears a decision was made to remove to_char(interval) at the 8.1 release but I've been unable to find the replacement for this functionality. This alarms me. Yeah. Karel Zak, who wrote that code, is convinced

Re: [HACKERS] Bug 1500

2005-03-25 Thread Karel Zak
On Fri, 2005-03-25 at 15:33 -0500, Tom Lane wrote: Lyubomir Petrov [EMAIL PROTECTED] 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

Re: [HACKERS] Bug 1500

2005-03-25 Thread Karel Zak
On Fri, 2005-03-25 at 20:03 -0500, Tom Lane wrote: Steve Crawford [EMAIL PROTECTED] writes: In digging around I discovered that it appears a decision was made to remove to_char(interval) at the 8.1 release but I've been unable to find the replacement for this functionality. This alarms

Re: [HACKERS] Bug 1500

2005-03-25 Thread Karel Zak
On Sat, 2005-03-26 at 02:32 +0100, Karel Zak wrote: On Fri, 2005-03-25 at 20:03 -0500, Tom Lane wrote: Steve Crawford [EMAIL PROTECTED] writes: In digging around I discovered that it appears a decision was made to remove to_char(interval) at the 8.1 release but I've been unable to

Re: [HACKERS] Bug 1500

2005-03-25 Thread Bruno Wolff III
On Fri, Mar 25, 2005 at 12:53:53 -0800, Steve Crawford [EMAIL PROTECTED] wrote: 2) If so, what is the replacement? You should be able to use EXTRACT, some math to do your own formatting. For common operations you can define SQL functions to do what you want. Having to_char(interval) may be