You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code will cause an error and then break the DB connection for further updates.
constDB=newKysely<Database>(...);constsomeIds=[undefined];// oops!constotherId=1234;try{awaitdb.selectFrom("a").where("id","in",someIds).execute(),}catch(e){// e is "QueryCompilerError: Could not serialize value" because of the undefinedawaitdb.updateTable("b").where("id","=",otherId).set({status: "error"}).execute();// line above throws another error because the generated SQL is // "(update "b" set "status" = :0 where "id" = :1)"// notice the parentheses around the generated SQL}
I confirmed that restarting the service and running the update call works fine because the generated SQL does not have the surrounding parentheses. I confirmed the presence of the parentheses with query.compile().sql.
The text was updated successfully, but these errors were encountered:
Ouch, thanks for opening the issue! We don't clear the OperationNodeVisitor.nodeStack at the beginning of compilation. The stack is left behind from that interrupted compilation.
But that query shouldn't pass typescript checks. The type of the array is undefined[]. Even if the type was (string | undefined)[] Kysely wouldn't accept it. Are you using some extremely loose typescript settings? Strict mode is needed for Kysely types to function properly.
Yep, you're absolutely right about the types. This was a simple repro to demonstrate the problem, but in the real case, the undefined sneakily got in there from a much earlier part of the pipeline.
The following code will cause an error and then break the DB connection for further updates.
I confirmed that restarting the service and running the update call works fine because the generated SQL does not have the surrounding parentheses. I confirmed the presence of the parentheses with
query.compile().sql
.The text was updated successfully, but these errors were encountered: