pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vitalii Tymchyshyn <tivv00@gmail.com>
To: RW Shore <rws228@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Array of compound not supported?
Date: Mon, 21 Feb 2011 11:34:17 +0200
Message-ID: <4D623199.3010703@gmail.com> (raw)
In-Reply-To: <AANLkTi=Lhdc6GvRZOZOkW4cxKdZtFjN2dmQrbWdJZiiA@mail.gmail.com>
References: <AANLkTi=Lhdc6GvRZOZOkW4cxKdZtFjN2dmQrbWdJZiiA@mail.gmail.com>

Have you tried setObject(1, str, Types.OTHER); ?

20.02.11 01:02, RW Shore написав(ла):
> I have a compound type defined as
>
> CREATE TYPE typedef.DECLASS_REASON_ENTRY AS (
> ENTRY_REASON VARCHAR(80),
> AUTHORIZING_USER VARCHAR(20)
> )
>
> and a table defined as
>
> create table table102 (field1 typedef.declass_reason_entry[] )
>
> The following statement works:
>
> insert into table102(field1) values 
> ('{"(\\"abcdef\\",\\"ghijkl\\")","(\\"abcdef\\",\\"ghijkl\\")"}')
>
> Consider the following prepared statement:
>
> insert into table102 (field1) values (?)
>
> If I use setString() on this prepared statement, execution throws a 
> variant of illegal type (complains about the parameter being a char 
> varying when it wants something else). If I use setObject() and pass 
> it a java.sql.Array implementation that wraps this same string, I get 
> a malformed array literal error.Note that the same code works fine 
> with arrays of all the built-in types, including point. No matter what 
> I do, I can't insert into the array of compound from my app.
>
> Anybody have any suggestions, or is array of compound simply not 
> supported via a prepared statement?




view thread (3+ messages)

Message-ID: <4D623199.3010703@gmail.com>
Permalink:  ../4D623199.3010703@gmail.com/
Also on:    postgresql.org/message-id/4D623199.3010703@gmail.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: tivv00@gmail.com, rws228@gmail.com
  Subject: Re: Array of compound not supported?
  In-Reply-To: <4D623199.3010703@gmail.com>
  References: <AANLkTi=Lhdc6GvRZOZOkW4cxKdZtFjN2dmQrbWdJZiiA@mail.gmail.com> <4D623199.3010703@gmail.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