Is First name and Last name unique for user record?

I was creating demo users from the User App.

When creating user 1, I used State as first name and User as last name.

When creating user 2, I used Lga as first name and User as last name.

I noticed that the system was throwing error 500. When I changed the user 2 last name to User 2, the record was saved.

I repeated this experience with other example and the experience persist which suggest that the last name as a unique constraint.

I will like to find out if there is a unique constraint on first name and last name.

There should be no constraint on having a unique first name and last name. I just tried to replicate this on the demo instance (2.39) and could not.

Please include the version of DHIS2 you are using along with an extract of the server logs when the error happens and we can try and see what is going on.

Regards,
Jason

I am using version 2.38.1.1

When I checked the log I got the error

 at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1407)
core_1     |    ... 161 more
core_1     | Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "userinfo_surname_key12"
core_1     |   Detail: Key (surname)=(User) already exists.

OK, yeah, that unique constraint should not be there. I would try and remove that constraint from the database table, and then restart DHIS2 and see if it is recreated.

1 Like

@jason Are you suggesting I should remove the constraint from the database table?

Yes. That constraint should not exist. I am not sure how it got added there, but it is not part of the standard set of constraints on a stock DHIS2 database.

2 Likes