Skip to content

relfk relationships referencing composite FKs with relationship-generated columns are dropped on save #2063

@djlrevic

Description

@djlrevic

Bug description
When a relfk relationship is backed by a composite foreign key, and at least one column in that FK is generated by pgModeler via rel1n, modifying an unrelated relationship property and saving causes those relfk blocks to be silently removed from the .dbm file, and the visual relationship lines to disappear. The underlying definitions are not affected. Closing and reopening the .dbm file correctly regenerates the relfk elements.

How to reproduce
See attached relfk-composite-fk-bug-repro.dbm (rename from .txt) -
relfk-composite-fk-bug-repro.dbm.txt. The model has:

schools with rel1n to teachers and rooms (injects school_uuid into both).
A schedule table with composite FKs to teachers and rooms — these ensure a teacher can't be assigned to a room at a different school (both FKs include school_uuid).
Two relfk visual relationships for those composite FKs.
An unrelated rel1n named change_my_src_required_to_trigger_bug.

To reproduce: open the file, toggle src-required on change_my_src_required_to_trigger_bug, save, and diff. The two rel_schedule_* relfk blocks will be gone.

Expected behavior
Only the modified relationship changes in the saved XML.

Actual behavior
The two blocks are removed, and the lines disappear. The definitions survive. Reopening the file regenerates the relfk blocks, but the next relationship property change and save drops them again.

Screenshots

Image

Info about your desktop

  • OS: Ubuntu 24.04.4 LTS
  • Window manager: Wayland
  • pgModeler version: 1.2.3
  • Qt version: ?

Stacktrace / Debug info
N/A

Additional info

relfk-composite-fk-bug-repro.dbm.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions