Re: Inserting Information in PostgreSQL interval - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: Inserting Information in PostgreSQL interval
Date
Msg-id 4A3ECC37.5080000@opencloud.com
Whole thread Raw
In response to Inserting Information in PostgreSQL interval  (BlackMage <dsd7872@uncw.edu>)
List 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

pgsql-jdbc by date:

Previous
From: BlackMage
Date:
Subject: Inserting Information in PostgreSQL interval
Next
From: BlackMage
Date:
Subject: Re: Inserting Information in PostgreSQL interval