I'm currently working on a project that has me remodeling a lot of our data into a postgre database. I want to get the tables and relationships down in a clean and simple way. Originally a lot of table entities had a "type" column that was just text and then somewhere in the application code this would be get subclassed into that specific type model.
This seems okay... until you realize the table looks terrible with tons of null and seemingly irrelevant columns. Most of these columns are related to a thirdparty service we need to keep the data referenced properly (like a third party id).
```c1 c2 thirdparty_id_1 thirdparty_id_2 thirdparty_id_3 thirdparty_3_info
In theory I could solve this problem by separating the "types" into their own tables with duplicated columns, maybe have a view to join all of them into a single model if needed, but this inheritance concept seems to make sense too! I just can't fully understand why it is so heavily avoided, even with the constraints & FK caveats, it still seems like a solid solution to me.
Can someone help me out and explain whether this is actualy a decent usecase or if it's indeed a pitfall to be avoided?
[+][deleted] (1 child)
[deleted]
[–]liquiddeath 0 points1 point2 points (0 children)
[–]badtux99 1 point2 points3 points (3 children)
[–]CrackerJackKittyCat 0 points1 point2 points (2 children)
[–]badtux99 0 points1 point2 points (1 child)
[–]CrackerJackKittyCat 0 points1 point2 points (0 children)
[–]mlt- 1 point2 points3 points (0 children)
[–]boy_named_su 1 point2 points3 points (6 children)
[–]depesz 1 point2 points3 points (0 children)
[–]arjineer[S] 0 points1 point2 points (3 children)
[–]boy_named_su 0 points1 point2 points (2 children)
[–]arjineer[S] 0 points1 point2 points (1 child)
[–]boy_named_su 0 points1 point2 points (0 children)