MagicStack / MagicStack/asyncpg
Unable to set Codec to Custom Type (pguint)
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 8.1k
- 分支
- 468
- PR 合併指標
- 30 天內沒有已合併 PR
描述
* **asyncpg version**: 0.20.0
* **PostgreSQL version**: 12.2
* **Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?**: No, N/A, N/A
* **Python version**: 3.8.0
* **Platform**: Linux 64bit (Ubuntu 18.04)
* **Do you use pgbouncer?**: No
* **Did you install asyncpg with pip?**: Yes
* **If you built asyncpg locally, which version of Cython did you use?**: N/A
* **Can the issue be reproduced under both asyncio and
[uvloop](https://github.com/magicstack/uvloop)?**: That's actually what I'm using.
I am using the user extension [pguint](https://github.com/petere/pguint) (there's a pg11&12 branch) and it's installed fine. I'm trying to load ~100GB of article data onto my database, so I'm using the binary copy functions.
I created a binary encoder and decoder:
``` python
await con.set_type_codec( 'uint1', encoder=lambda x: struct.pack('!B',x), decoder=lambda x: struct.unpack('!B',x), format='binary')
```
But when I try to use it, I get:
```
Caught Insert Error. UID:2419 EX: no binary input function available for type uint1
```
as my error. I tried delving into the source of this project but wasn't able to glean much. Does this error mean that the postgres extension itself is missing the required function on its end?
As a side note: I wrote a correct encoder/decoder (both text and binary) for the `tsvector` type, I want to submit a pull request but have no idea where I should put the new code, want to point me in the right direction?
also, should I be including the postgres `varlena` header in my binary encoding function outputs? or does your code do that?
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 set_type_codec 和報告中描述的二進位 COPY 函式開始,在 PostgreSQL 12.2、asyncpg 0.20.0、Python 3.8 和 uvloop 環境下重現 uint1 失敗。檢查 pguint 的二進位輸入行為以及關於 varlena 標頭的問題。確立原因和受支援的指引,並明確 tsvector codec 貢獻應放在哪裡,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- postgresql, python
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 25/100