Failed to compile InsertStmtImpl(INSERT_STMT)
See original GitHub issueBuild Environment SQLDelight version: 1.4.0 SQLDelight plugin version: 1.4.0 OS: Linux Gradle version: 6.5 Kotlin version: 1.3.72
I just updated to 1.4.0 from 1.3.0 and now my build fails on this statement:
CREATE TABLE MediaError(
id TEXT AS MediaId PRIMARY KEY NOT NULL REFERENCES Media(id),
error TEXT AS MediaErrors NOT NULL,
stacktrace TEXT DEFAULT NULL
);
upsert:
INSERT INTO MediaError(
id, error, stacktrace
)
VALUES (
:id, :error, :stacktrace
)
ON CONFLICT(
id
)
DO UPDATE SET
error = :error,
stacktrace = :stacktrace;
The error is:
> Failed to compile InsertStmtImpl(INSERT_STMT): [] :
INSERT INTO MediaError(
id, error, stacktrace
)
VALUES (
:id, :error, :stacktrace
)
ON CONFLICT(
id
)
DO UPDATE SET
error = :error,
stacktrace = :stacktrace
My gradle file:
sqldelight {
database("MyDatabase") {
packageName = "com.me.models.sqldelight"
sourceFolders = listOf("sqldelight-models", "sqldelight-migrations")
schemaOutputDirectory = file("src/main/sqldelight-migrations")
dialect = "sqlite:3.24"
}
}
I tried killing the gradle daemon, and that didn’t help.
If I remove ON CONFLICT...
it compiles.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
INSERT INTO MySQL statement failing [closed] - Stack Overflow
I dug through all of the string manipulation I was doing to dynamically build the query and found that I was using real_escape_string...
Read more >Why is this insert statement causing an error?
I think it's caused by the mapping, your field Country_of_Origin__c is a lookup field so you should map it to a.Id and not...
Read more >Database Engine events and errors - SQL Server
Consult this MSSQL error code list to find explanations for error messages for SQL Server database engine events.
Read more >insert (sql) - InterSystems Documentation
Description. The INSERT command inserts a row into a table or uses the results of a SELECT query to insert multiple rows into...
Read more >2 Server Error Message Reference - MySQL :: Developer Zone
Message: Statement is unsafe because it invokes a trigger or a stored function that inserts into an AUTO_INCREMENT column. Inserted values cannot be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@felipecsl That’s a different issue than the one @eygraber is describing, as the PostgreSQL grammar defined in sql-psi currently does not support upsert (whereas
sqlite:3.24
which is being used by @eygraber should be working as it’s defined in the respective sql-psi grammar file).Please feel free to open a separate issue (ideally in the sql-psi repo) so your issue doesn’t get lost in this one.
@AlecStrong this is blocking us from updating to Kotlin 1.4. Any help / pointers would be much appreciated 😄
I tried looking into it myself, and everything works if I change the statement to:
Obviously that wouldn’t work in reality.
Looking at the stacktrace, it seems like there needs to be another type handled in SqlSetterExpression.argumentType but I’m not sure which one it should be. Maybe
UpsertDoUpdate
?