MagicStack / MagicStack/asyncpg

no decoder for composite type element in position _ of type OID _

未關閉
#360 8 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
Python
星號
8.1k
分支
468
PR 合併指標
30 天內沒有已合併 PR

描述

  • asyncpg version: 0.17.0
  • PostgreSQL version: 10.5
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    :
  • Python version: 3.7.0
  • Platform: Linux
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: pipenv
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : asyncio definitely, untested with uvloop

Whenever I am trying to call a plpgsql stored procedure which returns a custom defined enum, I receive the following error:
RuntimeError: no decoder for composite type element in position 2 of type OID 88492

Type with OID 88492 in my database (from pg_catalog.pg_type) is listed as ssg.logintype which is defined as below:

	CREATE TYPE SSG.LOGINTYPE AS ENUM (
		'phone',
		'email'
	);

Partial traceback (asyncpg relevant parts):

  File "/home/mayzie/.local/share/virtualenvs/api-xyfAGMEp/lib/python3.7/site-packages/asyncpg/prepared_stmt.py", line 179, in fetchval
    data = await self.__bind_execute(args, 1, timeout)
  File "/home/mayzie/.local/share/virtualenvs/api-xyfAGMEp/lib/python3.7/site-packages/asyncpg/prepared_stmt.py", line 203, in __bind_execute
    self._state, args, '', limit, True, timeout)
  File "asyncpg/protocol/protocol.pyx", line 212, in bind_execute
  File "asyncpg/protocol/coreproto.pyx", line 71, in asyncpg.protocol.protocol.CoreProtocol._read_server_messages
  File "asyncpg/protocol/coreproto.pyx", line 205, in asyncpg.protocol.protocol.CoreProtocol._process__bind_execute
  File "asyncpg/protocol/coreproto.pyx", line 495, in asyncpg.protocol.protocol.CoreProtocol._parse_data_msgs
  File "asyncpg/protocol/protocol.pyx", line 770, in asyncpg.protocol.protocol.BaseProtocol._decode_row
  File "asyncpg/protocol/prepared_stmt.pyx", line 286, in asyncpg.protocol.protocol.PreparedStatementState._decode_row
  File "asyncpg/protocol/codecs/base.pyx", line 257, in asyncpg.protocol.protocol.Codec.decode
  File "asyncpg/protocol/codecs/base.pyx", line 166, in asyncpg.protocol.protocol.Codec.decode_scalar
  File "asyncpg/protocol/codecs/record.pyx", line 39, in asyncpg.protocol.protocol.anonymous_record_decode
RuntimeError: no decoder for composite type element in position 2 of type OID 88492

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

從 protocol/codecs/record.pyx 中所示的解碼路徑,以及 traceback 中提到的相關 prepared-statement 和 codec 檔案開始。使用 PostgreSQL 10.5、自訂 enum 和複合值重現儲存程序結果,然後追查 enum 元素缺少 decoder 的原因。完成的標準是結果在沒有報告的 RuntimeError 的情況下完成解碼,且此行為由回歸測試涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
postgresql, python
領域
backend, databases
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。