pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: BlackMage <dsd7872@uncw.edu>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Inserting Information in PostgreSQL interval
Date: Mon, 22 Jun 2009 12:11:35 +1200
Message-ID: <4A3ECC37.5080000@opencloud.com> (raw)
In-Reply-To: <24139349.post@talk.nabble.com>
References: <24139349.post@talk.nabble.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <4A3ECC37.5080000@opencloud.com>
Permalink:  ../4A3ECC37.5080000@opencloud.com/
Also on:    postgresql.org/message-id/4A3ECC37.5080000@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, dsd7872@uncw.edu
  Subject: Re: Inserting Information in PostgreSQL interval
  In-Reply-To: <4A3ECC37.5080000@opencloud.com>
  References: <24139349.post@talk.nabble.com> <4A3ECC37.5080000@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox