Search Postgresql Archives

Re: problem with a column of type timestamp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux