Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use insert statement shorthand in grouped query #1822

Closed
AlecKazakova opened this issue Jun 26, 2020 · 0 comments · Fixed by #3049
Closed

Cannot use insert statement shorthand in grouped query #1822

AlecKazakova opened this issue Jun 26, 2020 · 0 comments · Fixed by #3049

Comments

@AlecKazakova
Copy link
Collaborator

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant