PostgreSQL: populate(reserve_jobs=True) fails below a native time key

Offen
#1,763 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 5 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
86/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
postgresql, python
Bereich
backend, database

Rechercherichtung

Start with the reproduction in jobs.py, where primary-key attributes are copied into the jobs table definition, then inspect PostgreSQL type reporting in declare.py around match_type. Run the reproduction to confirm that Done.populate(reserve_jobs=True) fails while plain populate() succeeds. Done means PostgreSQL time and affected timestamp type names can be declared again and reservation succeeds without regressing MySQL.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

Bug

On PostgreSQL, populate(reserve_jobs=True) fails for a table whose primary key includes a native time attribute inherited from a parent:

DataJointError: Unsupported attribute type time without time zone

Reproduction

@schema
class Shift(dj.Manual):
    definition = """
    start_time : time
    """

@schema
class Done(dj.Computed):
    definition = """
    -> Shift
    """
    def make(self, key):
        self.insert1(key)

Shift.insert1({"start_time": "01:02:03"})
Done.populate(reserve_jobs=True)   # raises on PostgreSQL; works on MySQL

Plain populate() works on both backends.

Cause

The jobs table copies each primary-key attribute's type into its definition (jobs.py, attr.original_type or attr.type). For a native attribute, that type comes from the server: PostgreSQL reports time without time zone, which the declaration parser does not accept (declare.py, match_type).

Fix

Normalize these names when PostgreSQL column information is read (time, time(p), timestamp, timestamp(p), using datetime_precision), so the heading's type can be declared again. timestamp attributes are likely affected the same way (timestamp without time zone); this was not checked.

Vorherrschende Sprache
Python
Sterne
198
Forks
107
Ø Merge
4 T. 7 Std.
Gemergte PRs (30 T.)
12

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus datajoint/datajoint-python

Alle Issues in datajoint/datajoint-python

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

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