You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: Yes, problem is reproduced using the PostgreSQL provided by AWS and a local install
Python version: 3.7
Platform: Linux / Darwin 18.6.0 x86_64
Do you use pgbouncer?: No
Did you install asyncpg with pip?: Yes
If you built asyncpg locally, which version of Cython did you use?: No
Can the issue be reproduced under both asyncio and uvloop?: Yes
I have encountered that asyncpg decodes values of NUMERIC type with extra zero decimal digits despite the explicitly specified scale.
This code:
importasyncioimportasyncpgasyncdefmain():
conn=awaitasyncpg.connect()
awaitconn.execute(''' CREATE TABLE test_numeric( id serial PRIMARY KEY, value NUMERIC(1000, 8) ) ''')
awaitconn.execute(''' INSERT INTO test_numeric(value) VALUES('0.00003000') ''')
row=awaitconn.fetchrow('SELECT * FROM test_numeric;')
print(row)
awaitconn.close()
asyncio.get_event_loop().run_until_complete(main())
Produces the following output (12 digits right to the point while the scale of 8 was specified):
<Record id=1 value=Decimal('0.000030000000')>
However, in the database everything looks fine:
test=# SELECT * FROM test_numeric;
id | value
----+------------
1 | 0.00003000
The text was updated successfully, but these errors were encountered:
The size of the output buffer in numeric decoder is computed incorrectly
which may lead to stack corruption or access to unitialized memory.
This also fixes incorrect rendering of trailing zeros in some cases.
Fixes: #520Fixes: #514
The size of the output buffer in numeric decoder is computed incorrectly
which may lead to stack corruption or access to unitialized memory.
This also fixes incorrect rendering of trailing zeros in some cases.
Fixes: #520Fixes: #514
the issue with a local PostgreSQL install?: Yes, problem is reproduced using the PostgreSQL provided by AWS and a local install
uvloop?: Yes
I have encountered that asyncpg decodes values of NUMERIC type with extra zero decimal digits despite the explicitly specified scale.
This code:
Produces the following output (12 digits right to the point while the scale of 8 was specified):
However, in the database everything looks fine:
The text was updated successfully, but these errors were encountered: