db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vignesh Swaminathan" <vswam...@cordys.com>
Subject RE: Insert SQL error in PostgreSQL 8.1
Date Thu, 16 Feb 2006 11:44:11 GMT

> Is the model read from the database or from an XML file ?

The model is read from the database using 
platform.readModelFromDatabase(dataSource.getConnection(), null);

"Winning solutions find the right balance between market needs and
technical needs"

-----Original Message-----
From: Thomas Dudziak [mailto:tomdzk@gmail.com] 
Sent: Thursday, February 16, 2006 4:42 PM
To: ddlutils-user@db.apache.org
Subject: Re: Insert SQL error in PostgreSQL 8.1

On 2/16/06, Vignesh Swaminathan <vswamina@cordys.com> wrote:

> I am trying to insert a row into a simple table like
> (
>   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.

> 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 ?


The information in this message is confidential and may be legally  privileged. 
It is intended solely for the addressee. Access to this message by anyone else is 
unauthorized. If you are not the intended recipient, any disclosure, copying, or 
distribution of the message, or any action or omission taken by you in reliance 
on it is prohibited and may be unlawful. Please immediately contact the sender if 
you have received this message in error. This email does not constitute any 
commitment  from Cordys Holding BV or any of its subsidiaries except when 
expressly agreed in a written agreement between the intended recipient and 
Cordys Holding BV or its subsidiaries.

View raw message