Re: problem with a column of type timestamp - Mailing list pgsql-general

From brian
Subject Re: problem with a column of type timestamp
Date
Msg-id 4714E686.7010408@zijn-digital.com
Whole thread Raw
In response to problem with a column of type timestamp  (Sascha Bohnenkamp <bohnenkamp@mevisbreastcare.de>)
List pgsql-general
Sascha Bohnenkamp wrote:
> Hi,
>
> I have a table of type timestamp.
> I get the following error when I try to insert som edata to it:
>
> PGRES_FATAL_ERROR
> column "birthtime" is of type timestamp without time zone but expression
> is of type time without time zone  You will need to rewrite or cast the
> expression.
>

Sascha, the error is occuring because you are not including the date for
column birthtime. A timestamp column expects both a date and a time, eg:

2007-10-16 12:22:53

It appears as if you are attempting to insert just the '12:22:53' part.
If you prepend the date to that it should work just fine.

http://www.postgresql.org/docs/8.0/static/datatype-datetime.html

 > how can I set the timezone?
 >

The timezone is irrelevant to the problem. But if you do wish to store
the timezone, you'll have to alter the column so that it expects it.

ALTER TABLE your_table ALTER COLUMN birthtime TIMESTAMP WITH TIMEZONE;

http://www.postgresql.org/docs/8.0/static/sql-altertable.html

brian

pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Preserving view source code
Next
From: Michael Glaesemann
Date:
Subject: Re: problem with a column of type timestamp