Re: Inserting Information in PostgreSQL interval

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: BlackMage <dsd7872(at)uncw(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Inserting Information in PostgreSQL interval
Date: 2009-06-22 00:11:35
Message-ID: 4A3ECC37.5080000@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

BlackMage wrote:

> query.setObject(1, "{28.1, 29.2}");

> org.postgresql.util.PSQLException: ERROR: column "field_1" is of type
> interval[] but expression is of type character varying

The two-argument form of setObject() infers a type of Types.VARCHAR for
a java.lang.String (see the JDBC spec)

> So is there another way of entering an array of intervals into a postgresql
> database using prepared statement? What am I doing wrong?

Try:

query.setObject(1, "{28.1, 29.2}", Types.OTHER);

-O

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message BlackMage 2009-06-22 00:27:10 Re: Inserting Information in PostgreSQL interval
Previous Message BlackMage 2009-06-21 22:14:13 Inserting Information in PostgreSQL interval