Re: problem with a column of type timestamp

Поиск
Список
Период
Сортировка
От brian
Тема Re: problem with a column of type timestamp
Дата
Msg-id 4714E686.7010408@zijn-digital.com
обсуждение исходный текст
Ответ на problem with a column of type timestamp  (Sascha Bohnenkamp <bohnenkamp@mevisbreastcare.de>)
Список 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 по дате отправления:

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: Preserving view source code
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: problem with a column of type timestamp