-
Notifications
You must be signed in to change notification settings - Fork 107
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
receiving_address() raises DatabaseError with postgresql #23
Comments
Yeah this just hit me with postgres too. a lock on a select result means that |
The issue is that It's not a perfect solution but if you need a workaround for now you can add a distributed lock on the
Update this line in the 'new_bitcoin_address' function: The criteria are already set by bp.id, so long as nothing has utilized that address within the same timeframe of this occurrence of the function there will be no issues with duplicity in the database. That is the reason for the distributed lock, ensuring that the function cannot run in parallel within your app. For the same reason you also have to modify the call in the Wallet.receiving_address method. This The I hope that helps, there has to be a better way but unfortunately with the way it is built right now it'll take some design overhauls or a manual select statement that doesn't use an outer join, unfortunately I am not an SQL genius :(. |
I follow this tutorial:
http://opensourcehacker.com/2013/10/16/accepting-and-spending-bitcoins-in-a-django-application/
Everything is ok if database is sqlite (or mysql) but when I use postgresql (psycopg2) and I try to do master_wallet.receiving_address(fresh=False)
it returns
"DatabaseError: SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join"
It is problem in new_bitcoin_address() (django_bitcoin/models.py) around line 118:
Query it tries to run looks like this:
But I'm not sure what to do with this, why query looks like this or what should it do. Maybe I am doing something wrong, maybe django ORM is translating it not the way it should, or the ORM query is not what you expected it to be.
If you know how to fix this, I would love to use django-bitcoin in my project.
The text was updated successfully, but these errors were encountered: