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

Broken INSERT and UPDATE queries are generated when -Xsource:3 compiler option is set #2620

Open
sb-tech-wt2 opened this issue Oct 14, 2022 · 0 comments

Comments

@sb-tech-wt2
Copy link

Version: 4.5.0
Module: quill-jdbc
Database: postgresql

Without -Xsource:3:

QueryMirror(SELECT x.name, x.age FROM example_table x,Row(List()),app.Main$$anon$1$$Lambda$226/0x000000080128ace0@3b0f7d9d,io.getquill.context.ExecutionInfo@236ab296)
ActionMirror(INSERT INTO example_table (name,age) VALUES (?, ?),Row(List(Hello, 42)),io.getquill.context.ExecutionInfo@680bddf5)
ActionMirror(UPDATE example_table SET name = ?, age = ?,Row(List(Hello, 42)),io.getquill.context.ExecutionInfo@680bddf5)

With -Xsource:3:

QueryMirror(SELECT x.name, x.age FROM example_table x,Row(List()),app.Main$$anon$13$$Lambda$390/0x00000008012f8000@3c89bb12,io.getquill.context.ExecutionInfo@48c4245d)
ActionMirror(INSERT INTO example_table (name,age) VALUES (name, age),Row(List()),io.getquill.context.ExecutionInfo@2fc07784)
ActionMirror(UPDATE example_table SET name = name, age = age,Row(List()),io.getquill.context.ExecutionInfo@2fc07784)

Notice that there are no ? placeholders in the broken queries and also Row is empty (Row(List())).

Code

build.sbt

name := "quill-broken-queries"

scalaVersion := "2.13.9"
libraryDependencies ++= Seq(
  "org.postgresql" % "postgresql" % "42.5.0",
  "io.getquill" %% "quill-jdbc" % "4.6.0"
)
//scalacOptions ++= Vector("-Xsource:3")

Main.scala

package app

import io.getquill._

object Main extends App {
  case class ExampleTable(name: String, age: Int)
  object MyDBContext extends SqlMirrorContext(PostgresDialect, SnakeCase)
  import MyDBContext._

  val value = ExampleTable("Hello", 42)
  println(run(quote(query[ExampleTable])))
  println(run(quote(query[ExampleTable].insertValue(lift(value)))))
  println(run(quote(query[ExampleTable].updateValue(lift(value)))))
}

@getquill/maintainers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant