MagicStack / MagicStack/asyncpg
cockroachdb crdb - enums not working with prepared statements
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.1k
- Forks
- 469
- Ø Merge
- 18 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
- asyncpg version: 0.21.0
- CockroachDB version: v20.2.1
- PostgreSQL version: 12.4
- Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
the issue with a local PostgreSQL install?: - Python version: 3.9.0
- Platform: linux-x86_64
- Do you use pgbouncer?: no
- Did you install asyncpg with pip?: yes
- If you built asyncpg locally, which version of Cython did you use?:
- Can the issue be reproduced under both asyncio and
uvloop?: didn't test uvloop
enums have just been added to crdb. testing asyncpg shows an issue with prepared statements.
running this:
await conn.execute("INSERT INTO accounts2 (id, balance, mode) VALUES ($1, $2, $3)", 9, 2000, "active", )
throws
statement = await self._protocol.prepare(stmt_name, query, timeout)
File "asyncpg/protocol/protocol.pyx", line 163, in prepare
asyncpg.exceptions.FeatureNotSupportedError: CTEs may not be correlated
the prepared statement works fine in pgsql. enums work fine without prepared statements.
I have a silly bug exerciser, but needs some cleanup, you can see the relevant test2 functions if you need working code. i've tested psycopg2 and asyncpg against crdb and pgsql and out of the four runs, only asyncpg+crdb shows an issue.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit dem angehängten crdbissues.py.txt-Reproducer und dem unter asyncpg/protocol/protocol.pyx:163 zitierten prepare-Pfad. Vergleiche das Verhalten beim Einfügen eines Enums mit einem vorbereiteten Statement auf CockroachDB und PostgreSQL und verfolge anschließend die daraus resultierende Protokollverarbeitung. Erledigt ist die Aufgabe, wenn ein Regressionstest das vorbereitete Enum-Statement abdeckt und gegen die betroffene Datenbank ohne den CTE-Fehler erfolgreich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- postgresql, python
- Bereich
- backend, databases
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100