

On Wed, 26 Jan 2000, Peter Eisentraut wrote:

> Couldn't this be reduced to functions for timestamp, int4, int8, float8,
> and numeric?

With datetime/timestamp I not sure, exapmle date_part() exist for both.
And how is it with year in timestamp? 

test=> select '15000-01-26 21:01:57+01'::timestamp;
 ?column?
----------
 invalid
(1 row)

test=> select '15000-01-26 21:01:57+01'::datetime;
         ?column?
---------------------------
 Sun Jan 26 20:01:57 15000
(1 row)


Now is to_char's timestamp implementation very easy/terrible:

	text *timestamp_to_char(time_t dt, text *fmt)
	{
	        return datetime_to_char( timestamp_datetime(dt), fmt);
	}

:-) it call my classic datetime to_char(). I want rewrite it (and delete 
datetime version?), if I will certain with timestamp and timestamp to
'tm' struct conversion.  


Use float8's to_char only:

The to_char() convert it to string itself and must check float number 
range (FLT_DIG ..etc) and it is different for float4 and float8, but 
don't worry it is only 50 row in C. Yes, float4->float8 cast can make 
PG parser, but it is effective if you not need float8? IMHO this solution
reduce function/code, but not reduce performance/memory.   

(I re-send this mail to hacker list)
						Karel


Wed, 26 Jan 2000 20:32:02 +0100 (CET)
Karel Zak - Zakkr <zakkr@zf.jcu.cz>
Re: [PATCHES] commit TO_CHAR() 
> > Couldn't this be reduced to functions for timestamp, int4, int8, float8,
> > and numeric?
> With datetime/timestamp I not sure, exapmle date_part() exist for both.
> And how is it with year in timestamp?

Once we condense the number of date/time types, we can strip a few of
these functions. Thanks for doing a complete set though; much better
than not having enough!

                    - Thomas

-- 
Thomas Lockhart				lockhart@alumni.caltech.edu
South Pasadena, California

Thu, 27 Jan 2000 05:20:47 +0000
Thomas Lockhart <lockhart@alumni.caltech.edu>
Re: [PATCHES] commit TO_CHAR()