db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <tom...@gmail.com>
Subject Re: Insert SQL error in PostgreSQL 8.1
Date Thu, 16 Feb 2006 11:12:09 GMT
On 2/16/06, Vignesh Swaminathan <vswamina@cordys.com> wrote:

> I am trying to insert a row into a simple table like
>
> CREATE TABLE orders
> (
>   id int4 NOT NULL,
>   customerid int4,
>   orderdate timestamp,
>   shipdate timestamp,
>   CONSTRAINT orders_pkey PRIMARY KEY (id)
> )
>
> When I fire an insert using Platform.insert(Database, SQL) I get an
> exception message as follows. I tried printing the SQL using
> Platform.getInsertSQL which returned
>
> INSERT INTO "orders" ("id", "customerid", "orderdate", "shipdate")
> VALUES ('1000', '1000', '2006-03-16 00:00:00', '2006-04-21 00:00:00')
>
> However, when I fire this statement in the PostgreSQL query tool the
> insert goes ahead without problem. Please help.
>
<snip>

> Caused by: org.postgresql.util.PSQLException: ERROR: column "orderdate"
> is of type timestamp without time zone but expression is of type
> character varying

Looks like your database model has VARCHAR for the orderdate (and
possibly shipdate) column, and PostgreSql has no implicit default
conversion from string to timestamp. Is the model read from the
database or from an XML file ?

Tom

Mime
View raw message