Re: [PATCHES] commit TO_CHAR()
| От | Karel Zak - Zakkr |
|---|---|
| Тема | Re: [PATCHES] commit TO_CHAR() |
| Дата | |
| Msg-id | Pine.LNX.3.96.1000126200350.9764A-100000@ara.zf.jcu.cz обсуждение исходный текст |
| Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: