Skip to content

Verify if django-ingester is respecting kcidb limitations on fields update #1552

@nuclearcat

Description

@nuclearcat

In old kcidb ingestion we had certain limitations imposed, such as to not change checkout/build/test fields after they are set (we cannot update/delete non-null values).

Location(approx): kcidb/db/sql/schema.py:264-286
The INSERT statement uses ON CONFLICT ... DO UPDATE SET with COALESCE functions to preserve existing values:

ON CONFLICT (primary_key_columns) DO UPDATE SET
column_name = COALESCE(table.column_name, excluded.column_name)

The logic works as follows:

  1. Lines 264-269: Identifies primary key columns for the conflict resolution
  2. Lines 270-286: For non-primary-key columns, it uses COALESCE to decide which value to keep:
    - If prio_db is True: COALESCE(table.column, excluded.column) - keeps existing DB values if not NULL
    - If prio_db is False: COALESCE(excluded.column, table.column) - prefers new values if not NULL
    - For columns with conflict_func (like timestamps): Uses a specific function (e.g., GREATEST) to resolve conflicts
    (still need to check where and how prio_db used)

Metadata

Metadata

Assignees

Labels

DatabaseIssue that alters only configs of a database itselfIngesterThe issue relates to the ingester tool, including the command itself and related functions.

Type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions