PostgreSQL : duplicate key value violates unique constraint

Nextcloud version : 12.0.2
Operating system and version : archlinux (current)
Apache or nginx version : nginx 1.12.1
PHP version : 7.1.7
PostgreSQL : 9.6.3

Hi all !

I encounter a postgresql error message in my syslog everytime i login on my nextcloud instance :

ERROR: duplicate key value violates unique constraint "oc_credentials_pkey"
DETAIL: Key (“user”, identifier)=(, password::logincredentials/credentials) already exists.
STATEMENT: INSERT INTO “oc_credentials” (“user”, “identifier”, “credentials”) VALUES($1, $2, $3)

No problem for login/logout an using nextcloud, only this error message.

Is it a known bug ?
Could you please help ?

Thanks !


UNIQUE constraint same as primary key different is UNIQUE allow single NULL value.
UNIQUE constraint, every time you insert a new row, PostgreSQL checks if the value is already in the table. If it found that the new value is already there, it would give back an error message and reject the changes. The same process is carried out for the update existing data.

@cyayon thanks for reporting the bug.

I Just migrated from Mysql to PostgreSQL and saw these messages in the db log too.
Noticed that the bug report wasn’t linked.
And now it is :wink: