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

SQL Query Generation Error: Unquoted Keywords Causes Statement Errors with Postgres #2914

Open
fabianhjr-dealengine opened this issue Oct 12, 2023 · 0 comments
Labels
bug postgres Postgres related issue

Comments

@fabianhjr-dealengine
Copy link

fabianhjr-dealengine commented Oct 12, 2023

Version: 4.6.1
Module: quill-sql
Database: postgres

Expected behavior

Generated query works

Actual behavior

user is inserted as is without quotes which causes an error due to being a keyword in postgres

Steps to reproduce the behavior

case class User(id: Int, username: String, email: String)
case class Post(id: Int, title: String, content: String, userId: Int)

for {
  user <- query[User]
  if user.email == lift(email)
  post <- query[Post]
  if post.userId = user.id
} yield post

Should produce a query with user quoted as "user" but leaves it unquoted.

Workaround

Not using reserved keywords as var names (neither in fors, nor filters nor joins)

@getquill/maintainers

@guizmaii guizmaii added bug postgres Postgres related issue labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug postgres Postgres related issue
Projects
None yet
Development

No branches or pull requests

2 participants