pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Array of compound not supported?
3+ messages / 3 participants
[nested] [flat]

* Array of compound not supported?
@ 2011-02-19 23:02  RW Shore <rws228@gmail.com>
  0 siblings, 2 replies; 3+ messages in thread

From: RW Shore @ 2011-02-19 23:02 UTC (permalink / raw)
  To: pgsql-jdbc

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?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Array of compound not supported?
@ 2011-02-20 10:42  Lukas Eder <lukas.eder@gmail.com>
  parent: RW Shore <rws228@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Lukas Eder @ 2011-02-20 10:42 UTC (permalink / raw)
  To: pgsql-jdbc; +Cc: RW Shore <rws228@gmail.com>

On Feb 20, 12:02 am, rws228@gmail.com (RW Shore) wrote:
> Anybody have any suggestions, or is array of compound simply not supported
> via a prepared statement?

Check out my question a couple of weeks earlier:
http://archives.postgresql.org/pgsql-jdbc/2011-02/msg00038.php

There wasn't any authoritative answer yet, so I'm curiously following
this thread



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Array of compound not supported?
@ 2011-02-21 09:34  Vitalii Tymchyshyn <tivv00@gmail.com>
  parent: RW Shore <rws228@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Vitalii Tymchyshyn @ 2011-02-21 09:34 UTC (permalink / raw)
  To: RW Shore <rws228@gmail.com>; +Cc: pgsql-jdbc

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?




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2011-02-21 09:34 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-02-19 23:02 Array of compound not supported? RW Shore <rws228@gmail.com>
2011-02-20 10:42 ` Lukas Eder <lukas.eder@gmail.com>
2011-02-21 09:34 ` Vitalii Tymchyshyn <tivv00@gmail.com>

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