Skip to content

Cannot use insert statement shorthand in grouped query #1822

@AlecKazakova

Description

@AlecKazakova

Build Environment
SQLDelight version: 1.4.0

Describe the bug

upsert {
  UPDATE myTable
  SET column1 = :column1,
      column2 = :column2
  WHERE id = :id;
  INSERT OR IGNORE INTO myTable VALUES ?;
}
Caused by: java.lang.IllegalStateException: Failed to compile SqlDelightStmtClojureStmtListImpl(STMT_CLOJURE_STMT_LIST): [] :
INSERT OR IGNORE INTO myTable VALUES ?;
	at com.squareup.sqldelight.core.compiler.SqlDelightCompilerKt.tryWithElement(SqlDelightCompiler.kt:224)
	at com.squareup.sqldelight.core.compiler.QueriesTypeGenerator.addExecute(QueriesTypeGenerator.kt:123)
	at com.squareup.sqldelight.core.compiler.QueriesTypeGenerator.generateType(QueriesTypeGenerator.kt:115)
	at com.squareup.sqldelight.core.compiler.SqlDelightCompiler.writeImplementations(SqlDelightCompiler.kt:91)
	at com.squareup.sqldelight.core.SqlDelightEnvironment.generateSqlDelightFiles(SqlDelightEnvironment.kt:153)
	at com.squareup.sqldelight.gradle.SqlDelightTask.generateSqlDelightFiles(SqlDelightTask.kt:65)
Caused by: java.lang.AssertionError: Cannot bind unknown types or null
	at com.squareup.sqldelight.core.lang.IntermediateType$SqliteType.prepareStatementBinder(IntermediateType.kt:158)
	at com.squareup.sqldelight.core.lang.IntermediateType.preparedStatementBinder(IntermediateType.kt:95)
	at com.squareup.sqldelight.core.compiler.QueryGenerator.executeBlock(QueryGenerator.kt:125)
	at com.squareup.sqldelight.core.compiler.ExecuteQueryGenerator.function(ExecuteQueryGenerator.kt:60)
	at com.squareup.sqldelight.core.compiler.QueriesTypeGenerator$addExecute$1.invoke(QueriesTypeGenerator.kt:132)
	at com.squareup.sqldelight.core.compiler.QueriesTypeGenerator$addExecute$1.invoke(QueriesTypeGenerator.kt:22)
	at com.squareup.sqldelight.core.compiler.SqlDelightCompilerKt.tryWithElement(SqlDelightCompiler.kt:222)
	... 97 more

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions