Skip to content

Fix the error returned when class already exists #2955

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

Merged
merged 2 commits into from
Oct 28, 2016

Conversation

kulshekhar
Copy link
Contributor

Currently the createClass method of PosgresStorageAdapter throws a Parse.Error.INVALID_CLASS_NAME exception on an attempt to insert a class that already exists.

This PR changes this exception to Parse.Error.DUPLICATE_VALUE (which is also what the MongoDB adapter throws in a similar case)

@kulshekhar
Copy link
Contributor Author

@flovilmart there's another change I've made in the same method that this PR touches. However, the reason for that change is different. Should I update this PR with the new change or should I open another PR?

@flovilmart
Copy link
Contributor

Yeah update ahead :)

@facebook-github-bot
Copy link

@kulshekhar updated the pull request - view changes

@kulshekhar
Copy link
Contributor Author

The new change wraps the class creation in a transaction. This should fix a race condition (largely observable only during testing)

@flovilmart
Copy link
Contributor

@kulshekhar awesome!
There is that PR that introduced extracting all the SQL commands outside: #2600

@kulshekhar
Copy link
Contributor Author

@flovilmart Thanks. I wasn't aware of that PR.

Do you want this PR to be changed in some way?

@flovilmart
Copy link
Contributor

it's outdated, not mergeable, I was thinking you could pick it up as you're nailing that area :)

@kulshekhar
Copy link
Contributor Author

Sure, I'll make a note of it. The priority is to make Postgres a first class, well tested option for Parse first :)

@kulshekhar
Copy link
Contributor Author

Looks like this fixed the bug that was causing Postgres tests to fail. Although these tests are now failing due to another issue. Progress!! 🤘

@flovilmart
Copy link
Contributor

Awesome man! Merging then. there is that PR: #2907 that fixes the tests too.

@flovilmart flovilmart merged commit f23c0a5 into parse-community:master Oct 28, 2016
@kulshekhar kulshekhar deleted the pg-fix-incorrect-error branch October 28, 2016 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants