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

Using flilter + lift together with Insert Fails #37

Closed
fomkin opened this issue Nov 9, 2021 · 2 comments · Fixed by #76
Closed

Using flilter + lift together with Insert Fails #37

fomkin opened this issue Nov 9, 2021 · 2 comments · Fixed by #76
Milestone

Comments

@fomkin
Copy link

fomkin commented Nov 9, 2021

Version: v3.10.0.Beta1.6
Module: quill-jasync-postgres
Database: postgres
Scala: 3.1.0

inline def updateAccount = 
  query[Account]
    .filter(a => a.id == lift(account.id))
    .update(lift(account))
run(updateAccount)

Expected behavior

Code compiles.

Actual behavior

Compile time error:

[error]    |Invalid Transformations Encountered. Cannot find lift with ID: 5883cb8e-d883-4b0f-8944-679f9058fa44.
[error]    | This location contains code that was inlined from AccountRepositoryImpl.scala:42
[error]    | This location contains code that was inlined from Context.scala:167

Selecting, inserting and deleting compiles and works fine.
Also I tried to rewrite this with lazyLift and got:

Parsed Insert Macro AST is not a Case Class: 
ScalarTag("2d97b8c1-5872-47b3-9213-52c107e065ff") (or a batch-query Ident).

BUT it is update operation, not insert.
When I removing filter compilation begin to pass, but it is not I want.

Steps to reproduce the behavior

Workaround

      query[Account]
        .insert(lift(account))
        .onConflictUpdate(_.id)(
          (t, e) => t.updated -> e.updated,
          (t, e) => t.nickname -> e.nickname,
          (t, e) => t.email -> e.email,
          (t, e) => t.passwordHash -> e.passwordHash
        )

@deusaquilus

@deusaquilus
Copy link
Contributor

Whoops, I did not consider lifts in the final inner-entity expander. Will have a look at this soon.

@kimmoeklund
Copy link

kimmoeklund commented Jan 3, 2022

I have the same problem with postgres and "quill-jdbc" % "3.12.0.Beta1.7"

@deusaquilus deusaquilus changed the title Invalid Transformations Encountered Using flilter + lift together with Insert Fails Feb 8, 2022
@deusaquilus deusaquilus added this to the 1.0 Release milestone Feb 8, 2022
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

Successfully merging a pull request may close this issue.

3 participants