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

Batch insert with empty collection generates invalid SQL #431

Open
vladimir-lu opened this issue Apr 10, 2024 · 0 comments
Open

Batch insert with empty collection generates invalid SQL #431

vladimir-lu opened this issue Apr 10, 2024 · 0 comments

Comments

@vladimir-lu
Copy link

Version: 4.8.3
Module: quill-jdbc
Database: postgres

Actual behavior

When doing ctx.run(liftQuery(values).foreach(v => valueSchema.insert(v))) with a collection that is empty, the following SQL is generated: INSERT INTO table (a, b, c, ...) VALUES . The trailing VALUES is not parseable by postgres + sqlite (and probably others).

Expected behavior

Should be able to insert an empty collection of values (it should probably be a noop on the dynamic batcher level).

Steps to reproduce the behavior

Modify BatchUpdateValuesSpec to have an empty list for val dataBase: List[ContactBase] = Nil

Workaround

Check whether collection is empty before calling insert.

@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