MagicStack / MagicStack/asyncpg

"Cannot insert multiple commands into prepared statement" issue while executing query with params

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

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

question
主要言語
Python
スター
8.1k
フォーク
468
PR マージ指標
30日以内にマージされた PR はありません

説明

(python 3.5.1, asyncpg 0.5.4)

Consider the next code

```
import asyncpg
import asyncio

async def run():
con = await asyncpg.connect(user="coldmind", database="test")
await con.execute('SELECT ($1); SELECT 2;', 1)
asyncio.get_event_loop().run_until_complete(run())
```

The executing fails with `asyncpg.exceptions.PostgresSyntaxError: cannot insert multiple commands into a prepared statement` error, while the another example (without passing params to the query) works well with multiple commands:

```
import asyncpg
import asyncio

async def run():
con = await asyncpg.connect(user="coldmind", database="test")
await con.execute('SELECT 1; SELECT 2;')
asyncio.get_event_loop().run_until_complete(run())
```

Why is the first example using a prepared statement instead of executing it?

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

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

はじめの一歩

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

調査の方向性

Start with the con.execute entry point and run the two Python examples from the issue to compare parameterized and non-parameterized queries. Trace how parameters affect execution, then establish the expected behavior for multiple commands and document or test the resulting decision.

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

評価

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

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

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