postgresqlnexus3

Postgresql database error in Sonatype Nexus 3 prevents authentication via API and viewing of personal tokens


Newly created local users or LDAP users granted nexus access cannot login to repositories, nor can they view their token. The error from nexus.log is:

Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
### The error may exist in org/sonatype/nexus/internal/security/apikey/ApiKeyDAO.xml
### The error may involve org.sonatype.nexus.internal.security.apikey.ApiKeyDAO.save-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO api_key (primary_principal, domain, token, principals , created )         VALUES (?,                 ?, ?, ? , ? )     ON CONFLICT (primary_principal, domain, principals) DO UPDATE SET         token = ?, principals = ?,          created = ? ;
### Cause: org.postgresql.util.PSQLException: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification'; mapped from: org.sonatype.nexus.datastore.api.DataAccessException:
### Error updating database.  Cause: org.postgresql.util.PSQLException: ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification
### The error may exist in org/sonatype/nexus/internal/security/apikey/ApiKeyDAO.xml
### The error may involve org.sonatype.nexus.internal.security.apikey.ApiKeyDAO.save-Inline
### The error occurred while setting parameters

How can I fix this?


Solution

  • Solved by following the instructions for this type of error found in No unique or exclusion constraint matching the ON CONFLICT