Open
Description
When trying to insert into an entity with an auto-increment column that has a unique index, the insert fails due to duplicate keys.
Here is a minimal example to reproduce the issue on the most recent release 0.16.5:
@JvmStatic
fun main(args: Array<String>) {
val channel = ManagedChannelBuilder.forAddress("localhost", 1865).usePlaintext().build()
val client = SimpleClient(channel)
client.create(CreateSchema("test").ifNotExists())
client.create(
CreateEntity("test.test_entity")
.column(Name.ColumnName.create("id"), Types.Long, autoIncrement = true)
.column(Name.ColumnName.create("value"), Types.String)
.ifNotExists()
)
client.create(
CreateIndex(
Name.EntityName.create("test", "test_entity"),
CottontailGrpc.IndexType.BTREE_UQ
).column("id")
)
val batchInsert = BatchInsert("test.test_entity").columns("value")
batchInsert.any("first entry")
batchInsert.any("second entry")
batchInsert.any("third entry")
client.insert(batchInsert)
client.close()
}
Exception in thread "main" io.grpc.StatusRuntimeException: INVALID_ARGUMENT: [112, 6cd2516c-f613-4fac-96fe-d772fcb843e5] Execution of Insert query failed: Mapping of LongValue(value=1) to tuple 1 could be added to UniqueHashIndex, because value must be unique.
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
at org.vitrivr.cottontail.grpc.DMLGrpc$DMLBlockingStub.insertBatch(DMLGrpc.java:355)
at org.vitrivr.cottontail.client.SimpleClient.insert$lambda$14$lambda$13(SimpleClient.kt:180)
at io.grpc.Context.call(Context.java:551)
at org.vitrivr.cottontail.client.SimpleClient.insert$lambda$14(SimpleClient.kt:178)
at io.grpc.Context.call(Context.java:551)
at org.vitrivr.cottontail.client.SimpleClient.insert(SimpleClient.kt:176)
at org.vitrivr.cottontail.client.SimpleClient.insert(SimpleClient.kt:190)