MagicStack / MagicStack/asyncpg
Nested custom types in Postgres break `asyncpg.Record` subclassing
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 8.1k
- フォーク
- 468
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
-
asyncpg version: v0.25.0
-
PostgreSQL version: 14
-
Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: on-premise -
Python version: 3.10.1
-
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?: n/a
-
Can the issue be reproduced under both asyncio and
uvloop?: n/a
It would appear that nested types are not converted to a user specified record_class, and instead will always use asyncpg.Record.
For example:
CREATE TYPE my_custom_type AS (
id int,
filename text,
sql text
);
CREATE TABLE my_table (
files my_custom_type[] NOT NULL,
);
SELECT * FROM my_table
If you specify a custom record_class, then the record from SELECT * FROM my_table will be your subclass. However, the value inside record['files'] will use the asyncpg.Record class, rather than the custom one specified.
What should actually happen?
I think if a user specifies a record_class, then this class should always be used, even for nested custom types. It's quite unexpected behaviour for asyncpg to use the default class when a custom one has been specified.
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告に記載されているカスタム PostgreSQL 型、配列カラム、SELECT クエリ、カスタム record_class を使って問題を再現します。ネストされたカスタム型の値がどのようにデコードされ、record_class がどのように伝播されるかを追跡します。record['files'] 内のレコードが asyncpg.Record ではなく指定されたサブクラスを使用し、このケースのリグレッションテストによるカバレッジがある状態を完了とします。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- postgresql, python
- 領域
- databases
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100