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

Abierto
#1,763 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
86/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
postgresql, python
Área
backend, database

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
198
Forks
107
Merge medio
4 d 7 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de datajoint/datajoint-python

Todos los issues de datajoint/datajoint-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.