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

オープン
#1,763 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 5 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
postgresql, python
領域
backend, database

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
198
フォーク
107
平均マージ
4日 7時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

datajoint/datajoint-python のほかの issue

datajoint/datajoint-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。