Open lynt1 opened 1 year ago
You might need to lift
the 3
:
def deletePersonWithId(id: Int) =
quote {
querySchema[Person]("Person").filter(_.age == lift(id)).delete
}
You might need to
lift
the3
:def deletePersonWithId(id: Int) = quote { querySchema[Person]("Person").filter(_.age == lift(id)).delete }
@guizmaii I do same as your comment but I still get error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'x6 WHERE x6.age = 3' at line 1.
@lynt1 What is the generated query, please? Because the code seems to be valid.
@lynt1 What is the generated query, please? Because the code seems to be valid.
I faced a similar problem. It seems the reason is that generated query uses an alias in a way that Mariadb "does not support". In my case for some test table:
case class TestQuillDelete(id: Long)
and
quill.run(quote(query[TestQuillDelete].filter(_.id < lift(2L)).delete))
The generated query is:
DELETE FROM test_quill_delete x1 WHERE x1.id < ?
quill.run(quote(query[TestQuillDelete].filter(_.id < lift(2L)).delete))
Which is executed with similar to topic starter's error.
Whereas a query without aliases executed correctly:
DELETE FROM test_quill_delete WHERE id < 2;
Versions: quill-jdbc-zio: 4.8.3 MariaDB: 11.3.2
This template isn't a strict requirement to open issues, but please try to provide as much information as possible.
Version: 4.8.0 Module: quill-jdbc-zio Database: mariadb 10.9
Steps to reproduce the behavior
Run: querySchema("Person").filter(person => person.age == 3).delete With error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'person WHERE person.age = 3' at line 1
@getquill/maintainers