Skip to content

fix: delete user saved selections if user is gone#352

Merged
f-necas merged 1 commit intogeorchestra-gn4.4.xfrom
fix-user-saved-selections-not-dropped
Feb 18, 2026
Merged

fix: delete user saved selections if user is gone#352
f-necas merged 1 commit intogeorchestra-gn4.4.xfrom
fix-user-saved-selections-not-dropped

Conversation

@f-necas
Copy link
Collaborator

@f-necas f-necas commented Feb 5, 2026

Sometimes, user synchronization was failing with the error:

Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "users" violates foreign key constraint "fkq971r8i90nbrn42wgw43f71bd" on table "usersavedselections"                                       │
│   Detail: Key (id)=(401) is still referenced from table "usersavedselections".

It's because someone who doesn't exist anymore has used the "Favorite" functionnality of GN (often used with datahub)

So we now delete those selections before trying to delete user.

@fvanderbiest
Copy link
Member

Nice catch.
No side effects expected ?

@f-necas
Copy link
Collaborator Author

f-necas commented Feb 5, 2026

I don't think so, user should be in sync with console and external_user table and it happens only on them.

@f-necas f-necas requested a review from pmauduit February 13, 2026 15:37
Copy link
Member

@pmauduit pmauduit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had commented on this one: I am surprised it requires an explicit deleteAllByUser call, and would have expected that JPA was capable of removing linked objects in its own model.

Other than that, looks fine.

@f-necas f-necas merged commit 3290256 into georchestra-gn4.4.x Feb 18, 2026
1 check passed
@f-necas f-necas deleted the fix-user-saved-selections-not-dropped branch February 18, 2026 11:31
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 this pull request may close these issues.

3 participants