zio / zio-protoquill

Quill for Scala 3
Apache License 2.0
204 stars 48 forks source link

Using batch insert with latest oracle jdbc generate a database error (ora-17144) #478

Open nolondil opened 1 month ago

nolondil commented 1 month ago

Version: 4.8.5 Module: quill-jdbc Database: Oracle Oracle JDBC version: ojdbc11 23.4.0.24.05

Expected behavior

Using batch insert with liftQuery and database generated value should complete without any exception.

Actual behavior

Trying to do a batch insert will throw the new exception: https://docs.oracle.com/en/error-help/db/ora-17144/?r=23ai

Steps to reproduce the behavior

Any oracle database and simple class such as:

case class A(id: Int)

val as: Seq[A] = _

run(liftQuery(as).foreach(query[A].insert(_).returningGenerated(_.id))) // should insert and return database generated values for ids and not throw the exception at the database level

Workaround

Avoid using the liftQuery for a batch insert with generated values and rely on single insert. But this will add more round trips to the database. @getquill/maintainers