Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

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: Mon, 22 Jun 2009 12:11:35 +1200
  • Message-id: <4A3ECC37.5080000@opencloud.com> <text/plain>

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



Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group