如果插入一条空数据,会报Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: syntax error at or near "RETURNING"

@Data
@Builder
@TableName("media")
public class MediaEntity {
  @TableId(value = "id", type = IdType.AUTO)
  private Long id;
  private String video;
  private String voice;
}


@Test
public void insertMedia() {
    MediaEntity entity = MediaEntity.builder().build();
    mediaMapper.insert(entity);
}

Comment From: nieqiurong

提供下执行sql日志.

Comment From: Routee

提供下执行sql日志.

MyBatis-Plus 通过mapper.insert(T t)插入数据报错

JDBC Connection [HikariProxyConnection@1267221951 wrapping org.postgresql.jdbc.PgConnection@63f91457] will not be managed by Spring
==>  Preparing: INSERT INTO test VALUES
==> Parameters: 

期待的是:insert into temp (value) values(null);

CREATE TABLE test
(
    id           bigint                              NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1000000 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ) primary key,
    value        varchar
);
@Data
@Builder
@TableName(value = "test")
public class TestEntity {
    @TableId(type = IdType.AUTO)
    private Long id;
    private String value;
}

Comment From: nieqiurong

这个情况我可能需要配合那个主键策略一起调整修改了.

Comment From: sunxiaojian

@nieqiurong hi, 请教个问题 , 这个 RETURNING 是在哪里加上的, 是自动加上的吗