apache / apache/grails-core

Unique constraint is not multiple data source aware

Open
#14,628 14 comments 0 reactions 0 assignees View on GitHub
relates-to: gorm
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

Hi

As i understand, the unique constraint should only ensure uniqueness in one datasource but in case of multiple datasource it is checking for uniqueness across all the datasources.

[github.com/hamza3202/grails-unique-constraint-bug](https://github.com/hamza3202/grails-unique-constraint-bug) is a sample project. Just run it and open localhost:8080/abc/index and you should see the error.
I am on grails 3.2.2 java 1.8

Contributor guide

Open the contributing guide

Research direction

Run the linked hamza3202/grails-unique-constraint-bug sample with Grails 3.2.2 and Java 8, then open localhost:8080/abc/index to reproduce the error. Trace how the unique constraint handles the configured multiple datasources; done means uniqueness is checked within the relevant datasource rather than across all datasources.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, java
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.