From: | Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Casting timestamp with time zone to varchar automatically |
Date: | 2004-08-04 06:23:44 |
Message-ID: | opsb62put1cq72hf@musicbox |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Idea :
Create a function with the same name as your function, but which takes a
timestamp as an argument, converts it to a string according to your
specifications, then calls your function which needs a string.
Postgresql will decide which function to call according to the types of
the arguments.
> Unfortunatly, that still doesn't really answer my question. I have a
> generic function that accepts varchars, and I'd like to be able to feed
> it timestamps without explicitly converting. That's why I'd like to know
> if there is a specific reason there's no default timestamp -> varchar
> cast.
>
> On Tue, Aug 03, 2004 at 03:57:36PM +0900, Michael Glaesemann wrote:
>>
>> On Aug 3, 2004, at 3:12 PM, Jim C. Nasby wrote:
>>
>> >Is there any reason why there isn't a predefined cast to go from a
>> >timestamp to a varchar? Is there a reason not to add one?
>>
>> to_char should do what you need. People often need a specific form of
>> timestamp if they need it to be a text value (rather than a native
>> timestamp data type). to_char provides lots of flexibility
>>
>>
>> Michael Glaesemann
>> grzm myrealbox com
>>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Gunasekaran Balakrishnan | 2004-08-04 08:51:38 | Test case for bug fix in 7.4.3 |
Previous Message | Marius Andreiana | 2004-08-04 05:40:52 | Re: [PERFORM] NOT IN query takes forever |