From: | Karel Zak - Zakkr <zakkr(at)zf(dot)jcu(dot)cz> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
Subject: | Re: [PATCHES] commit TO_CHAR() |
Date: | 2000-01-26 19:32:02 |
Message-ID: | Pine.LNX.3.96.1000126200350.9764A-100000@ara.zf.jcu.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff MacDonald <jeff@pgsql.com> | 2000-01-26 19:43:24 | SQL 92 |
Previous Message | Don Baccus | 2000-01-26 19:05:39 | Re: [HACKERS] Inheritance, referential integrity and other constraints |