Array of compound not supported?
От | RW Shore |
---|---|
Тема | Array of compound not supported? |
Дата | |
Msg-id | AANLkTi=Lhdc6GvRZOZOkW4cxKdZtFjN2dmQrbWdJZiiA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Array of compound not supported?
|
Список | 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?
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?
В списке pgsql-jdbc по дате отправления: