From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Jim C(dot) Nasby" <decibel(at)decibel(dot)org> |
Cc: | Michael Glaesemann <grzm(at)myrealbox(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Casting timestamp with time zone to varchar automatically |
Date: | 2004-08-04 04:48:57 |
Message-ID: | 16887.1091594937@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Jim C. Nasby" <decibel(at)decibel(dot)org> writes:
> ... I'd like to know
> if there is a specific reason there's no default timestamp -> varchar
> cast.
There is an explicit cast from timestamp to varchar, at least in recent
releases:
regression=# select 'now'::timestamp::varchar;
varchar
---------------------------
2004-08-04 00:42:05.34875
(1 row)
Whether this should be invokable implicitly is somewhat of a theological
issue, but personally I'm agin it. My experience is that implicit
cross-type-category casts are Bad News All Around because they tend to
happen when you weren't expecting it, resulting in quite surprising
behavior. (An implicit cast from, say, timestamp to date is far less
dangerous.) You can find lots of discussion about related issues in
the list archives.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Marius Andreiana | 2004-08-04 05:40:52 | Re: [PERFORM] NOT IN query takes forever |
Previous Message | Scott Ribe | 2004-08-04 04:19:10 | Re: trash talk |