apache / apache/grails-core

Support empty list argument in dynamic finder inList

Open
#14,533 3 comments 0 reactions 0 assignees View on GitHub
relates-to: grails-data-hibernate5 status: pr submitted
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Now with posgresql BD Book.findAllByYearInList([]) fails with wrong sql exception "in ()"
At result, dummy code with isEmpty() checking have to be written additionally to business code

Will try to provide PR

https://github.com/grails/grails-data-mapping/blob/master/grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/MethodExpression.java#L250

### Environment Information

- **Operating System**: TODO
- **GORM Version:** TODO
- **Grails Version (if using Grails):** 3.2.11
- **JDK Version:** TODO

### Example Application

- TODO: link to github repository with example that reproduces the issue

Contributor guide

Open the contributing guide

Research direction

Start with grails-datastore-gorm/src/main/groovy/org/grails/datastore/gorm/finders/MethodExpression.java at the linked line and reproduce the issue with Book.findAllByYearInList([]) on PostgreSQL. Done means the empty-list finder no longer generates invalid "in ()" SQL or raises the reported exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, postgresql
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.