我无法在Postgres数据库中插入空值,数据类型为bytea(blob)。以下是我的Java代码片段:
ps.setNull(++index, java.sql.Types.BLOB);
bytea列是一个可空列。以下是表的描述。
testdb=# \d+ plan
Table "public.plan"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+-------+-----------+----------+--------------+-------------
description | bytea | | extended | |
Has OIDs: no
我遇到了以下异常: java.sql.BatchUpdateException: Batch entry 11 INSERT INTO public.plan(description) VALUES(NULL) was aborted. Call getNextException to see the cause.
setObject(++index, null)
或setNull(++index, Types.OTHER)
。 - user330315