Invalid OID Handling in SQLAlchemy with asyncpg and autoload_with Causes DataError
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Non sono indicati né un file sorgente né un test. Inizia riproducendo il caricamento dei metadati di SQLAlchemy Table(..., autoload_with=conn) su PostgreSQL 14 con asyncpg 0.30.0 e l’OID segnalato, quindi traccia la gestione del parametro OID. Il lavoro è completato quando il caricamento dei metadati riesce per OID superiori all’intervallo int32 senza DataError.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
I encountered an issue when using SQLAlchemy with asyncpg and the autoload_with option while trying to load table metadata. The problem occurs because PostgreSQL's oid type is treated as a signed 32-bit integer (int32) by asyncpg, which leads to a DataError when the OID value exceeds the maximum range of int32 (2,147,483,647).
Steps to Reproduce
- Create a PostgreSQL table with an OID that exceeds the int32 range. For example, an OID like 3195477613.
- Use SQLAlchemy to define the table with autoload_with to load metadata:
from sqlalchemy import Table, MetaData
metadata = MetaData()
table = Table("master_product_view", metadata, autoload_with=conn)
- Execute the code.
Observed Behavior
The following exception is raised during metadata loading:
sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) <class 'asyncpg.exceptions.DataError'>: invalid input for query argument $1: 3195477613 (value out of int32 range)
Expected Behavior
The autoload_with option should correctly handle OID values, even if they exceed the int32 range.
asyncpg/SQLAlchemy Version in Use
asyncpg 0.30.0
sqlalchemy 1.4.54
Database Vendor and Major Version
PostgreSQL 14
Python Version
3.13
Operating system
Linux
- Lingua principale
- Python
- Stelle
- 8.1k
- Fork
- 469
- Merge medio
- 2g 20h
- PR unite (30g)
- 9
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MagicStack/asyncpg
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MagicStack/asyncpg#1357 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
MagicStack/asyncpg#1354 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
MagicStack/asyncpg#1342 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
MagicStack/asyncpg#1340 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 28/100
MagicStack/asyncpg#1337 ·
Tutte le issue di MagicStack/asyncpg
Issue simili
-
货币战争手改优先级配置缺少列表元素类型校验(P3) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Apertaarea: ci bug perceived difficulty: 3
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/clickhouse-connect#1057 ·