From: | brian <brian(at)zijn-digital(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: problem with a column of type timestamp |
Date: | 2007-10-16 16:27:50 |
Message-ID: | 4714E686.7010408@zijn-digital.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2007-10-16 16:30:08 | Re: problem with a column of type timestamp |
Previous Message | Thomas Kellerer | 2007-10-16 16:02:22 | Preserving view source code |