MagicStack / MagicStack/asyncpg

Functions with record array paraments

オープン
#951 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
8.1k
フォーク
469
平均マージ
18分
マージ済み PR(30日)
4

説明

I'm trying to invoke a function with a signature like this:

CREATE OR REPLACE FUNCTION "ns"."test"(p1 "ns"."my_type"[])

It results in the following exception being raised:

Traceback (most recent call last):
  File "asyncpg/protocol/prepared_stmt.pyx", line 168, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
  File "asyncpg/protocol/codecs/base.pyx", line 206, in asyncpg.protocol.protocol.Codec.encode
  File "asyncpg/protocol/codecs/array.pyx", line 115, in asyncpg.protocol.protocol.array_encode
  File "asyncpg/protocol/codecs/array.pyx", line 115, in asyncpg.protocol.protocol.array_encode
TypeError: a sized iterable container expected (got type 'dict')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
    buffer, _, self._exhausted = await protocol.bind_execute(
  File "asyncpg/protocol/protocol.pyx", line 183, in bind_execute
  File "asyncpg/protocol/prepared_stmt.pyx", line 197, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
asyncpg.exceptions.DataError: invalid input for query argument $1: {'holiday_center': '123', 'observed_on':... (a sized iterable container expected (got type 'dict'))

How do I invoke such a function?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

SQL 関数シグネチャと asyncpg/protocol/codecs/array.pyx に示されている配列エンコーダーから始め、引数が asyncpg/protocol/prepared_stmt.pyx に到達するまでを追跡します。record-array パラメーターを使って呼び出しを再現し、受け付けられる入力形式を報告されている dict エラーと比較します。関数を正常に呼び出せ、動作がテストでカバーされているか、明確に文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
postgresql, python
領域
backend, databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。