pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

[ERD]: Let the user specify table inheritance in ERD tool (RM #7301)

Open dpage opened this issue 3 years ago • 13 comments

Issue migrated from Redmine: https://redmine.postgresql.org/issues/7301 Originally created by Alessandro Martinelli at 2022-04-08 13:12:55 UTC.

As of now, in order to add an inheritance relationship between two tables, one needs to manually modify the SQL code generated by the ERD tool (attached picture Add table inheritance manually ). And this must be repeated every time the ERD is modified and tables are re-generated from it. The other option is to use a custom script to re-create tables requiring inheritance relationship and run it after tables generation. Howerver it would be nice if ERD tool could handle this on its own.

After tables have been created, inheritance relationship is visible from table properties (attached picture Modify table after creation ). It would be nice to have something like that in the ERD tool too (attached picture Modify table ERD )

dpage avatar Apr 08 '22 13:04 dpage

Image migrated from Redmine: https://redmine.postgresql.org/attachments/download/6721 Originally created by Alessandro Martinelli at 2022-04-08 13:12:30 UTC.

Add_table_inheritance_manually.PNG

Filename: Add_table_inheritance_manually.PNG

dpage avatar Apr 08 '22 13:04 dpage

Image migrated from Redmine: https://redmine.postgresql.org/attachments/download/6722 Originally created by Alessandro Martinelli at 2022-04-08 13:12:33 UTC.

Modify_table_after_creation.PNG

Filename: Modify_table_after_creation.PNG

dpage avatar Apr 08 '22 13:04 dpage

Image migrated from Redmine: https://redmine.postgresql.org/attachments/download/6723 Originally created by Alessandro Martinelli at 2022-04-08 13:12:37 UTC.

Modify_table_ERD.PNG

Filename: Modify_table_ERD.PNG

dpage avatar Apr 08 '22 13:04 dpage

Image migrated from Redmine: https://redmine.postgresql.org/attachments/download/6724 Originally created by Alessandro Martinelli at 2022-04-08 13:15:12 UTC.

Add_table_inheritance_manually.PNG

Filename: Add_table_inheritance_manually.PNG

dpage avatar Apr 08 '22 13:04 dpage

Image migrated from Redmine: https://redmine.postgresql.org/attachments/download/6725 Originally created by Alessandro Martinelli at 2022-04-08 13:15:16 UTC.

Modify_table_ERD.PNG

Filename: Modify_table_ERD.PNG

dpage avatar Apr 08 '22 13:04 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-6 Originally created by Alessandro Martinelli at 2022-04-08 13:15:26 UTC.

Redmine ticket header update:

Name Old Value New Value
Attachment added Modify table ERD.PNG
Attachment added Add table inheritance manually.PNG

dpage avatar Apr 08 '22 13:04 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-7 Originally created by Alessandro Martinelli at 2022-04-08 13:19:19 UTC.

Please remove the first version of images Add table inheritance manually.PNG and Modify table ERD.PNG , uploaded at 13:12

dpage avatar Apr 08 '22 13:04 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-8 Originally created by Alessandro Martinelli at 2022-04-08 14:18:45 UTC.

I just realized that, if an user plans to use inheritance, there is a good possibility that he/she cannot use ERD tool at all: let's say you have table base and table a inheriting from base. base has a id fields which will be primary key for a too, thus in table a you will not specify the id field, since it will be inherited from base. If now you need to add table b with field b_a_id , which should be in 1-to-M relationship with a.id , you cannot do this in ERD tool since table a has no id field. So in this - not so specific - use case the user cannot use ERD tool at all.

dpage avatar Apr 08 '22 14:04 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-9 Originally created by Nikhil Mohite at 2022-05-13 11:13:53 UTC.

Redmine ticket header update:

Name Old Value New Value
Assigned To changed Aditya Toshniwal

dpage avatar May 13 '22 11:05 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-10 Originally created by Aditya Toshniwal at 2022-05-19 04:44:02 UTC.

Redmine ticket header update:

Name Old Value New Value
Sprint changed Ready
Assigned To changed Aditya Toshniwal

dpage avatar May 19 '22 04:05 dpage

Comment migrated from Redmine: https://redmine.postgresql.org/issues/7301#note-11 Originally created by Aditya Toshniwal at 2022-05-19 04:44:37 UTC.

Redmine ticket header update:

Name Old Value New Value
Relationship (duplicated) changed RM #7395

dpage avatar May 19 '22 04:05 dpage

Maybe the option would be that the inheriting table also displays the fields of the ancestor table, but visually they're greyed out or something, indicating that they're inherited, and from an SQL POV, they're not specified, just inherited. Then the inheritance relationship could be specified. For an example of what this might look like visually, see https://martinfowler.com/eaaCatalog/classTableInheritance.html .

wayland avatar Aug 25 '23 22:08 wayland

Since 1-1 relationship has recently been added, maybe this should be based on that.

IgorArnaut avatar Mar 28 '25 10:03 IgorArnaut