MagicStack / MagicStack/asyncpg
BC dates result in error running the query
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
* **asyncpg version**: asyncpg=0.18.3=py37h1de35cc_0
* **PostgreSQL version**: PostgreSQL 11.1 on x86_64-apple-darwin18.2.0, compiled by Apple LLVM version 10.0.0 (clang-1000.11.45.5), 64-bit
* **Do you use a PostgreSQL SaaS? No
* **Python version**: 3.7
* **Platform**: osx
* **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](https://github.com/magicstack/uvloop)?**: Tried only asyncio
When a date or datetime column includes dates in the form of `0001-01-01 BC` which are valid postgres dates, the driver returns the following:
```
result = await executor(stmt, None)
File "asyncpg/protocol/protocol.pyx", line 196, in bind_execute
File "asyncpg/protocol/coreproto.pyx", line 65, in asyncpg.protocol.protocol.CoreProtocol._read_server_messages
File "asyncpg/protocol/coreproto.pyx", line 202, in asyncpg.protocol.protocol.CoreProtocol._process__bind_execute
File "asyncpg/protocol/coreproto.pyx", line 498, in asyncpg.protocol.protocol.CoreProtocol._parse_data_msgs
File "asyncpg/protocol/protocol.pyx", line 754, in asyncpg.protocol.protocol.BaseProtocol._decode_row
File "asyncpg/protocol/prepared_stmt.pyx", line 282, in asyncpg.protocol.protocol.PreparedStatementState._decode_row
File "asyncpg/protocol/codecs/base.pyx", line 288, in asyncpg.protocol.protocol.Codec.decode
File "asyncpg/protocol/codecs/base.pyx", line 195, in asyncpg.protocol.protocol.Codec.decode_scalar
File "asyncpg/pgproto/./codecs/datetime.pyx", line 133, in asyncpg.pgproto.pgproto.date_decode
ValueError: ordinal must be >= 1
```
**ValueError: ordinal must be >= 1**
I assume this is some kind of a problem mapping from the BC date to a python date, however this is annoying since valid postgres tables can't be queries. At least in the interim it should be possible to return None if for some reason the date couldn't be parsed but not give up entirely. Is there a quick and dirty way around that?
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
asyncpg/pgproto/./codecs/datetime.pyx の traceback に示されている date_decode パスから始め、0001-01-01 BC を含む PostgreSQL の date または datetime で失敗を再現してください。既存の date codec テストを確認し、BC 値でサポートされる結果を特定してください。この作業の完了条件は、そのような行をデコードしてもクエリが中断されず、その動作が回帰テストでカバーされていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100