Skip to content

ExoQuery batch capture failure #86

Description

@edreyer

ExoQuery batch capture failure (JDBC)

Summary

Using sql.batch(...) with JDBC produces compile-time warnings ("batch-action could not be transformed at compile-time")
and then fails at runtime with MissingCaptureError: Compile time plugin did not transform the tree. This happens even
with the batch syntax shown in the ExoQuery docs.

Environment

  • Kotlin 2.2.21
  • ExoQuery plugin 2.2.20-2.0.1.PL
  • ExoQuery runner JDBC 2.0.1.PL
  • Postgres (via JDBC)

Minimal reproduction

import io.exoquery.sql
import io.exoquery.innerdsl.setParams
import kotlinx.serialization.Serializable

@Serializable
data class Person(val id: Int, val name: String)

val people = listOf(
  Person(1, "Joe"),
  Person(2, "Jill"),
)

val q =
  sql {
    sql.batch(people) { person ->
      insert<Person> {
        setParams(person)
      }
    }
  }

// Running the compiled batch action fails at runtime.
q.buildFor.Postgres().runOn(myDatabase)

Observed output

Compiler warnings:

The batch-action could not be transformed at compile-time

Runtime error:

io.exoquery.MissingCaptureError: Compile time plugin did not transform the tree
    at io.exoquery.DslKt.errorCap(Dsl.kt:43)
    at io.exoquery.sql.invoke(Dsl.kt:60)

Notes

  • This is the same pattern shown in the official docs (batch insert example).
  • Because the capture does not transform, the batch action cannot be executed at runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions