-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL : duplicate key value violates unique constraint error message #6343
Comments
Could you try this one here as well: #366 (comment) Thanks. |
Hi, I just tried redis-cli FLUSHALL command (return OK), but the PostrgreSQL error message continue to appears after each logon ... |
@cyayon Are you using LDAP Auth? |
Hi, No, i am using simple locale authentication. |
Same issue for me: Nextcloud version : 12.0.3 Local auth, no redis cache. |
I'm also affected.
PostgreSQL 9.6.5 This is even after I did |
Yes, same here. |
Well the issue is actually: server/lib/private/DB/Connection.php Line 289 in 0eebff1
Maybe we should change that to "insert if not exists" instead. to avoid logging the error (which we catch php-wise afterwards). |
Yes please. |
Still having this issue in NC 13... |
Having the same issue. Why are you trying to insert and only then try to update? The normal case would be that a user already exists in the database.... IF you want to do it that way it would make sense to do it the other way around (i.e. first try to update and if that fails insert) ... although this still looks to me like horrible style.. (NC13 from git with stable13-branch and postgres 9.4) |
Let me advocate for the UPSERT once more, then I'll shut up about it 🙃 It does exactly that:
It's implemented in pgsql >= 9.5 and would do the job on the DB. It could eliminate the need for the entire For me the concept of
sounds error prone. A little hacky, if you will. |
I've found this issue after seeing this constantly in my logs: ERROR: duplicate key value violates unique constraint "oc_credentials_pkey" Please, please do not have this as normal/expected behaviour. I thought something was genuinely wrong with my install and have spent a fair bit of time on and off trying to diagnose it. It looks from #366 and the above posts that both the cause and solution are known? Nextcloud 13.0.2 I love Nextcloud and you work - hope this can be fixed and an error-free install can have error-free logs. |
Still having this issue in NC 14... Edit: config++ |
Shouldn't this be flagged as a security issue? Having nextcloud fill up systemd logs makes it difficult to read them and look for issues... For the moment I raised postgres log level to "critical", but then i wont know if the other services that use postgres run properly. :/ |
Just use `grep -v`.
…-- Brad
On Sep 8, 2018, at 7:30 AM, Llaurence ***@***.***> wrote:
Shouldn't this be flagged as a security issue? Having nextcloud fill up systemd logs makes it difficult to read them and look for issues...
For the moment I raised postgres log level to "critical", but then i wont know if the other services that use postgres run properly. :/
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Any updates on this issue? Any plans to get it fixed? Any possible workarounds? As it was mentioned above, this is definitely a security issue as constantly flooding the logs with error messages makes it very difficult to audit. |
Adding a comment so this issue doesn't get auto-marked "stale" again. Issue is still present in 16.0.3. |
The same with the Nextcloud
Additional infoStrange part is that
This is how the table was created:
|
Unfortunately, the same happens with Nextcloud Are there any plans to address this issue? Any help needed? |
This comment has been minimized.
This comment has been minimized.
^ Testing it since > 1 week, no side effects as far as I can tell, no more postgres error spam in syslog 👍 maybe a proper review from someone who knows this part of the codebase won't hurt, but I think this should go upstream |
This comment has been minimized.
This comment has been minimized.
@kesselb Perhaps it's time for a pull request? It doesn't seem like anyone will react to your comment (tbf, there are 2k open issues and you didn't mention anybody in your last reply). |
@kesselb Your patch solved our issues with PostgreSQL/LDAP/oc_credentials. |
@kesselb so what is the status of this issue in the end? :) |
I added some more background about that issue here: #19494 (comment) My patch might fix the issue or not. At least it seems to work for some people. I'm not interested to dig any further because MariaDB is my preferred RDBMS. One benefit from the patch is that the credentials are not written again on every login (for every RDBMS). |
Would you like to open a PR with your patch? |
I don't have time to look into the adjustments for the tests. |
I marked the patches as outdated. They both assume that credentials are always an array. That's at least not true if you use the ldap_contacts_backend app and probably for others apps as well. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Is this really fixed? If I understand correctly, once you have a need for the credentials, they'll be touched very often, again. Wouln'd it rather help if either |
How to use GitHub
Steps to reproduce
just logon on nextcloud and check syslog/postgresql log messages
Server configuration
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)=(myuser, password::logincredentials/credentials) already exists.
STATEMENT: INSERT INTO “oc_credentials” (“user”, “identifier”, “credentials”) VALUES($1, $2, $3)
No problem for login/logout and using nextcloud, only this error message.
Thanks !
The text was updated successfully, but these errors were encountered: