MagicStack / MagicStack/asyncpg

OverflowError: date value out of range

Offen
#412 5 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
8.1k
Forks
468
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

  • asyncpg version: 0.18.3
  • PostgreSQL version: 10.7
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : Yes
  • Python version: 3.7
  • Platform: Mac OS
  • 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?
    :

asyncpg is failing to parse timestamp

code:

import asyncio
import asyncpg

async def run():
    conn = await asyncpg.connect(user='secure', password='secure',
                                 database='secure',
                                 host='secure.com', port=15432, timeout=600)

    values = await conn.fetch('''SELECT  _ts FROM Events''')
    print(values)
    await conn.close()


loop = asyncio.get_event_loop()
loop.run_until_complete(run())
Timestamp format: 2019-01-01T08:42:25.921Z
Traceback (most recent call last):
  File "/scratch_65.py", line 21, in <module>
    loop.run_until_complete(run())
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/scratch_65.py", line 15, in run
    values = await conn.fetch('''SELECT  _ts FROM Events''')
  File "/lib/python3.7/site-packages/asyncpg/connection.py", line 421, in fetch
    return await self._execute(query, args, 0, timeout)
  File "/lib/python3.7/site-packages/asyncpg/connection.py", line 1414, in _execute
    query, args, limit, timeout, return_status=return_status)
  File "/lib/python3.7/site-packages/asyncpg/connection.py", line 1422, in __execute
    return await self._do_execute(query, executor, timeout)
  File "/lib/python3.7/site-packages/asyncpg/connection.py", line 1444, in _do_execute
    result = await executor(stmt, None)
  File "asyncpg/protocol/protocol.pyx", line 196, in bind_execute
  File "asyncpg/protocol/coreproto.pyx", line 65, in asyncpg.protocol.protocol.CoreProtocol._read_server_messages
  File "asyncpg/protocol/coreproto.pyx", line 202, in asyncpg.protocol.protocol.CoreProtocol._process__bind_execute
  File "asyncpg/protocol/coreproto.pyx", line 498, in asyncpg.protocol.protocol.CoreProtocol._parse_data_msgs
  File "asyncpg/protocol/protocol.pyx", line 754, in asyncpg.protocol.protocol.BaseProtocol._decode_row
  File "asyncpg/protocol/prepared_stmt.pyx", line 282, in asyncpg.protocol.protocol.PreparedStatementState._decode_row
  File "asyncpg/protocol/codecs/base.pyx", line 288, in asyncpg.protocol.protocol.Codec.decode
  File "asyncpg/protocol/codecs/base.pyx", line 195, in asyncpg.protocol.protocol.Codec.decode_scalar
  File "asyncpg/pgproto/./codecs/datetime.pyx", line 252, in asyncpg.pgproto.pgproto.timestamptz_decode
OverflowError: date value out of range

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit asyncpg/pgproto/./codecs/datetime.pyx bei timestamptz_decode und reproduziere anschließend den Fehler mithilfe der bereitgestellten Python-Abfrage gegen PostgreSQL. Verfolge, wie der gemeldete Zeitstempel dekodiert wird, und füge für diesen Fall Tests hinzu, falls das Repository einen geeigneten Testort hat. Als erledigt gilt die Aufgabe, wenn die Abfrage den Zeitstempel ohne OverflowError zurückgibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
postgresql, python
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.