-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Incorrect Decimal('Infinity') adaptation #1724
Comments
Thank you for the report. The solution is probably little enough invasive that we can provide it in the next bugfix release. Psycopg 3 already does the right thing: >>> import psycopg.sql
>>> from decimal import Decimal
>>> psycopg.sql.quote(Decimal("Infinity"))
"'Infinity'::numeric" |
Got a fix: #1735 |
I am reconsidering the opportunity of changing this behaviour. Yes, converting inf -> nan is not correct but otoh I don't know if there are applications out there assuming it... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since v14, PostgreSQL NUMERIC type supports
Infinity
value. But for now, psycopg2 adaptsInfinity
as'NaN'::numeric
. This can be avoided by creating custom type adapter that wraps decimal value in quotes, but still, adapting toNaN
seems like outdated logic.The text was updated successfully, but these errors were encountered: