0
在我的表中,我有一个主键字符变化(64)[]列。Java PostgreSQL插入引发意外错误
以下代码:
Statement stmt = c.createStatement();
String sql =
"INSERT INTO schema.table (integer_col, char_varying_col) VALUES (2, 'hi');";
stmt.executeUpdate(sql);
stmt.close();
抛出:
ERROR: malformed array literal: \"hi\"\n Detail: Array value must start with \"{\" or dimension information.\n Position: 82
但是,如果我改变语句
Statement stmt = c.createStatement();
String sql =
"INSERT INTO schema.table (integer_col, char_varying_col) VALUES (2, '{hi}');";
stmt.executeUpdate(sql);
stmt.close();
然后将其插入{hi}
表..
你有一个数组列 - 是不是你想要的? – stdunbar
你可以显示该表的ddl吗?尽管它的名字'char_varying_col'似乎有一个数组类型... – fvu