MagicStack / MagicStack/asyncpg
bug: Incorrect serialization of numeric values
オープン
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
- asyncpg version: 0.29.0
- PostgreSQL version: 13
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: no SaaS, yes reproducable with local postgres - Python version: 3.10
- Platform: linux
- Do you use pgbouncer?: no
- Did you install asyncpg with pip?: yes
- If you built asyncpg locally, which version of Cython did you use?: none
- Can the issue be reproduced under both asyncio and
uvloop?: yes
This happens when query selects a numeric column. Numbers like 10000, 100000, etc. get serialized in scientific notation. For example 10000 becomes 1E+4.
To reproduce the error, you can do the following:
Inside tests/test_codecs/test_numeric if 10000 is added in cases then the test fails, due to incorrect serialization logic.
async def test_numeric(self):
# Test that we handle dscale correctly.
cases = [
'0.001',
'0.001000',
'1',
'1.00000',
'10000', # new test case
]
fail error:
line 614, in test_numeric
self.assertEqual(str(res), case)
AssertionError: '1E+4' != '10000'
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
tests/test_codecs/test_numeric から始め、失敗を再現するために test_numeric のケースに 10000 を追加します。10000 ではなく 1E+4 を返す原因となっている数値シリアライゼーションのロジックを追跡し、その後テストを実行して、既存のケースが期待される小数文字列を維持したまま引き続き通過することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100