-
Notifications
You must be signed in to change notification settings - Fork 18
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
eliminate race condition when updating types #26
Comments
I've proposed on http://psycopg.lighthouseapp.com/projects/62710-psycopg/tickets/183 that, as the race condition appears ineliminable, psycopg2 might raise a subclass of DataError instead of DataError itself (which is defined by DB-API 2.0 and is used for several error conditions in psycopg2; the spec seems to allow for subclassing). That way we could retry the query after re-registering composites, and make this transparent to consumers. |
Follow-up over there:
Sounds sensible, assuming we can guarantee that there are no other |
The |
We could also inspect |
Or we could re-perform the original test: tokens = self.tokenize(s)
if len(tokens) != len(self.atttypes):
raise psycopg2.DataError(
"expecting %d components for the type %s, %d found instead" %
(len(self.atttypes), self.name, len(tokens))) |
Well, at least we're not the only ones with this problem. :-)
|
|
We ran into an issue over on gratipay/gratipay.com#1583 in that psycopg2 caches information about composite types, so if you alter the type in the database then the cache becomes stale, and the next time you request a record of the composite type, you get a
DataError
. From @dvarrazzo:And over on http://psycopg.lighthouseapp.com/projects/62710/tickets/183:
How do we eliminate this race condition?
The text was updated successfully, but these errors were encountered: