MagicStack / MagicStack/asyncpg
"Cannot insert multiple commands into prepared statement" issue while executing query with params
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 8.1k
- Forks
- 468
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
(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?
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- postgresql, python
- Domaine
- databases
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 35/100