-
Notifications
You must be signed in to change notification settings - Fork 1.1k
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[ SQL ] Misleading error message on email update #386
Comments
What does your RPC function look like? |
This was before we added update_time = now() - which didn't work.
Then we changed the query to |
We do not control the error messages from SQL. The In this case you should only get an error there if the email address is already in use by a different user. When you first tried the query was it with a different user ID (or a different email address) than the 2nd attempt? |
I see. Well the email was the same and the response was a constraint violation that had nothing to do with the updated_time field. This is where the confusion. Below le' error.
|
Was the user ID different between the two attempts? The error looks correct if you try to set an email address on a user ID when it's already being used by a different user ID. I suspect the |
Nope. same attempt, same everything. The only diff is |
Sounds strange, I can't think of a reason the update time would make a difference since the uniqueness constraint is only defined on the email column alone. I'm not sure what version of the database you're running or how your schema modifications might play into it but it doesn't seem to be a Nakama server issue so I'll close this for now. |
Well neither do we and that constraint about the email mislead us. The DB version is 19.1.5 |
I should also mention for the record we don't recommend modifying Nakama's own tables, and if you add any additional tables there should be no constraints or relationships to Nakama's own tables. Each operation in Nakama is designed specifically around a known schema and we can't guarantee what would happen from a data integrity or performance perspective if 'known' tables are changed. You should also be careful about storing any personal information (like phone number) in the database outside of Nakama's known schema. The built-in GDPR support won't be aware of them if you do, so you'll be responsible for GDPR compliance outside of the available tooling. |
fair enough and thank you for the pointers. The GDPR compliance is also treated on our end so that is taken care of. The current issue we described is not related however to the above ( useful ) mentions. The problem is replicated ( we just did the test ) on an unmodified table as well, plus the thrown error is not related to any of the added columns. It may be a constraint on the DB that acts funny. |
When trying to update the email field in the users table via a RPC function, one gets the duplicate key constraint error in the docker logs.
The problem here is the error is not correct nor the docs. In order to update the email field on the users table one needs to add the update_time = now() to the update query, after which the query executes correctly.
It should be added in the docs and the error message from SQL should be more specific.
Description
Example: When updating a user's email address, the RPC call fails 500 error
Steps to Reproduce
Create a simple RPC function and call it from the front end to update the email for the current user.
Expected Result
The email should be updated
Actual Result
The server responds with 500 error
Context
Your Environment
The text was updated successfully, but these errors were encountered: