zio / zio-quill

Compile-time Language Integrated Queries for Scala

Home Page:https://zio.dev/zio-quill

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL syntax when call delete method

lynt1 opened this issue · comments

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

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 the 3:

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.