Skip site navigation (1) Skip section navigation (2)

Re: auto update dates

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: Joel Burton <joel(at)joelburton(dot)com>
Cc: Postgresql Novice List <pgsql-novice(at)postgresql(dot)org>
Subject: Re: auto update dates
Date: 2002-05-23 23:24:47
Message-ID: 20020523232447.GB15332@campbell-lange.net (view raw or flat)
Thread:
Lists: pgsql-novice
On 23/05/02, Joel Burton (joel(at)joelburton(dot)com) wrote:
> current_time returns timezone information, but you're trying to store
> this in a field that is time w/o timezone information. either coerce
> this data yourself, or make the field hold timezone info.
> 
> Better question, though: why are you storing the date, the time, and
> the timestamp? Much easier to simply store the timestamp. You can
> always get the date & time from that. This will save you space _and_
> time. (Plus, your current problem would become irrelevant).

Hi Joel

Thanks very much for your mail.

I can see that working with CAST I can extract the date and
(theoretically) the time from the timestamp. Thanks very much for the
suggestion.

	brandf=# select cast(current_timestamp as time);
	ERROR:  Cannot cast type 'timestamp with time zone' to 'time without
	time zone'

How do I get around this? I can see various time functions with and
without time zone data, but I don't know how to utilise them.

Thanks
Rory

-- 
Rory Campbell-Lange 
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>

In response to

Responses

pgsql-novice by date

Next:From: Patrick HatcherDate: 2002-05-23 23:29:32
Subject: Re: COPY returns Bad timestamp external rep..
Previous:From: Rory Campbell-LangeDate: 2002-05-23 23:14:59
Subject: Re: query problem - get count in related table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group