Skip to main content

Questions tagged [inheritance]

For questions about extending a base object's features into a derived object.

Filter by
Sorted by
Tagged with
1 vote
1 answer
706 views

Django Multi Table Inheritance and Preserving Child and Child History

Place can have many different one to one fields, that’s why it can have bookstore, restaurant, and hardware store. But can the same place be both a bookstore and a restaurant at the same time? Now if ...
Malik A. Rumi's user avatar
2 votes
2 answers
545 views

DB model strategy to override field value

We have to store some dynamic configuration in JSON format in DB. There would be some default configuration, and it can be overriden per account. Can someone help me with the strategy to store such ...
sidgate's user avatar
  • 131
2 votes
2 answers
4k views

Postgres inherit from one role and not another

I'm a little new with postgres but have a decent understanding of roles. What I have are users that inherit from their normal "data_analyst" group. This group is used to manage all data analyst users ...
Pistol Pete's user avatar
5 votes
2 answers
14k views

Best practise for polymorphic associations in MySQL

I have a MySQL database with 3 tables holding the main classes of data: companies (company_id) persons (person_id, company_id) loans (loan_id, company_id) Both a 'loan' and a 'person' belong ...
ratherBeKiting's user avatar
5 votes
2 answers
1k views

Postgresql inheritance based database design

I'm developing a simple babysitter application that has 2 types of users: a 'Parent' and the 'Babysitter'. I'm using postgresql as my database but I'm having trouble working out my database design. ...
Jdruwe's user avatar
  • 153
0 votes
2 answers
1k views

Modeling a product database and dealing with inheritance

So, to get better at designing databases, I'm attempting to model a database system after the AR15 Builder. Here is what I have so far: While it makes sense logically, I'm afraid there may be ...
Jester Jeffrey's user avatar
0 votes
1 answer
437 views

Is it possible to set order in which inherited tables a scanned in postgresql?

I have a postgresql measurement table which is partitioned based on logdate column by month. Suppose I have city_id integer column and want to select latest row with city_id = 125. When I run explain ...
lompy's user avatar
  • 1
3 votes
1 answer
4k views

Postgres 9.5 foreign table inheritance not using indexes

In PostgreSQL 9.5.0 I have a partitioned table that collects data by months. I tried to use the new PostgreSQL feature of foreign table inheritance and pushed one month of data to another PostgreSQL ...
Dzmitry Nikitsin's user avatar
2 votes
3 answers
593 views

Record inheritance in mySQL

I have been struggling with this for a little while. I want to have a set of calendar records. The top level will apply to a large group; the next level will apply to a sub-set and the final level ...
Richard's user avatar
  • 21
1 vote
0 answers
1k views

PostgreSQL doesn't use index on inherited tables

I have two tables in PostgreSQL 9.4.5 deployed on Amazon RDS: an append only, weekly partitioned, All Positions table. These store all position readings from about 100,000 sensors. There are about 50 ...
Justin Wong's user avatar
2 votes
1 answer
101 views

Finding a good DB design for my project

I've posted this on stackOverflow but this might be a more suitable place. I'm really struggling to find a good DB design for my project using SQL server. I've already implemented a few models which ...
LiranBo's user avatar
  • 123
6 votes
1 answer
3k views

Index is not used with table inheritance

I have a PostgreSQL 9.0.12 database with a master table and 2 child tables. My tables: CREATE TABLE test2 ( id serial PRIMARY KEY, coll character varying(15), ts timestamp without time ...
umut's user avatar
  • 285
7 votes
1 answer
5k views

Performance issues with inherited tables and indices

I have a PostgreSQL database with a master table and 2 child tables. My master table: CREATE TABLE test ( id serial PRIMARY KEY, date timestamp without time zone ); CREATE INDEX ON test(...
umut's user avatar
  • 285
7 votes
1 answer
941 views

PostgreSQL and table inheritance

I'm not sure if this is the right place for this, so please feel free to tell me if it is off-topic or there is a better place to post. I am working on a fantasy sports based project, and the number ...
JermaneBoggus's user avatar
2 votes
2 answers
497 views

Dimensional Model for inheritance in dimensions

How are dimensions typically modeled in a dimensional model if one dimension logically inherits from another dimension? For example, assume I have an Employee dimension and a Driver dimension, where ...
Justin Grant's user avatar
11 votes
2 answers
3k views

Conceptual ERD Multi-table many to many, or possibly recursive?

I'm creating a conceptual diagram [yes, I know I've included attributes and keys - but this is just for me to consolidate what I'm doing whilst learning] -- so please treat it as Conceptual with the ...
MVC Newbie's user avatar
1 vote
0 answers
284 views

Alter schema of Access 2013 database with linked table

I'm trying to change the schema of an Access 2013 table. I want to lengthen some of the text fields. When I change the schema and try to save I get dialog with Operation is not supported for this type ...
abalter's user avatar
  • 127
4 votes
1 answer
2k views

Enhanced ER Model Supertype / Subtype modeling issue with inheritance and recursion

Before posting, I have looked for a good solution on internet and I have coined this post for 3 days in row and trying to think through it prior this post. So if I have missed something or got it ...
Zalom's user avatar
  • 143
4 votes
2 answers
1k views

How to enforce data consistency across one-to-one relationship in an inheritance hierarchy

Consider this design for a typical school database: Person: ----------------- FirstName LastName SocialSecurityNumber Phone Email Student: ----------------- Grade Teacher: ----------------- ...
Saeed Neamati's user avatar
0 votes
2 answers
131 views

Inheritance of unknown type at creation time

Say I have a table called People into which people are inserted from the moment they are born. Now lets say I want some subclasses of people based on their job. So there are also tables for Plumber, ...
TheRealJimShady's user avatar
7 votes
2 answers
12k views

Query parent table and get child tables columns

I have two tables, one inherits the other: CREATE TABLE parent ( col1 INTEGER ); CREATE TABLE child ( col2 INTEGER ) INHERITS( parent ); // Insert some data INSERT INTO parent( col1 ) ...
frenchie4111's user avatar
8 votes
2 answers
11k views

Partial unique constraint spanning multiple tables in postgres

To enforce partial uniqueness in postgres, it is a well known workaround to create a partial unique index instead of an explicit constraint, like so: CREATE TABLE possession ( possession_id serial ...
lpd's user avatar
  • 251
1 vote
1 answer
539 views

Will switching from Concrete Table Inheritance to Single Table Inheritance improve the performance of my queries?

I currently have an application that allows people to view and share 10 different types of posts (ex SportsPost, WorldNewsPost, TechnologyPost, etc). All posts types are conceptually the same, but ...
fbonetti's user avatar
  • 111
0 votes
3 answers
5k views

Can i have one foreign key to both parent and it's childs in postgresql?

I want to have a foreign key to reference table and it's children. Here's how I tried and failed: CREATE TABLE parent ( id serial, CONSTRAINT parent_pk PRIMARY KEY(id) ); CREATE TABLE child ( ...
Ben's user avatar
  • 257
0 votes
1 answer
678 views

PostgreSQL migrate data from one table to another (which inherits the first one)

I have a table "company" and another named "school" ("school" table inherits "company"). Most of the data is community generated and sometimes a cleaning is needed. I would like to be able to "...
Vincent Caggiari's user avatar
3 votes
1 answer
1k views

Inheritance or lot of relationship?

I have to transpose a class Diagram into a Physical Data Model (more precisely MySQL database structure). In my class diagram, I have a lot of entities (A, B, C, D) which inherit from an other entity,...
csblo's user avatar
  • 131
11 votes
5 answers
56k views

Insert into select into multiple related tables using INSERT_IDENTITY

Okay setting the scene. I have three tables, (Table1, Table2 and DataTable) and I want to insert into Table1 and Table2 using DataTable as source. So for every row in DataTable I want a row in Table1 ...
m4rc's user avatar
  • 235
1 vote
1 answer
2k views

Inheritance discriminator column better int or varchar or enum?

What is the best practice for storing a discriminator column ? Does it make any difference ? Any pros/cons of using one over the other ? I am using MySql with Entity Framework but the question goes ...
Bart Calixto's user avatar
0 votes
0 answers
761 views

PostgreSQL and Single Table Inheritance

I read about STI (Single Table Inheritance) and like the idea. Does PostgreSQL handle 95% NULL values in some columns if I have about 1M rows well? Does it impact performance if there many columns (~...
guettli's user avatar
  • 1,561
0 votes
1 answer
654 views

Foreign key double inheritance SQLITE

I'm designing a domotic system database and I'm trying to figure out how to represent two foreign keys. This is the cardinality I want. Consider 1...N Areas (rooms, halls, kitchens, etc.): Area 1 - ...
cabreracanal's user avatar
2 votes
1 answer
543 views

Is this a step in the right direction for normalization? SQL 'inheritance' and Many-to-Many relationships

Context: So, this is kind of a compound question, but they go together, and definitely wouldn't make sense split up into separate questions. I've been working on a new database for what will end up ...
user2759920's user avatar
1 vote
1 answer
2k views

Cannot add or change records

I'm designing a database structure wherein I like to apply the concept of inheritance. There's a base tables and derived tables in which the relationship is one-to-one. I'm quite new as of how could ...
mr5's user avatar
  • 127
0 votes
1 answer
96 views

Table join inheritance

I create db with Person, Client, Employee, Manager, Developer. I'm interested what is the best way to put the data in tables. In which cases should programmer unite Client in table hierarchy with ...
Ray's user avatar
  • 143
7 votes
2 answers
5k views

Polymorphic Association - is it bad?

In the following schema: Collections Upvotes Reports Upvotes Reviews Upvotes I'm tempted to have a single Upvotes table with a single "entityId" column that stores either the CollectionId, ...
RobVious's user avatar
  • 171
0 votes
1 answer
680 views

Altering a parent table in Postgresql 8.4 breaks child table defaults

The problem: In Postgresql, if table temp_person_two inherits fromtemp_person, default column values on the child table are ignored if the parent table is altered. How to replicate: First, create ...
Curtis Poe's user avatar
0 votes
1 answer
84 views

Mapping and Inserting Values into a Specialized table

For a system i'm designing,i have one parent entity,Computer Computer(computer_id,computer_processor,computer_hddrive,computer_memory); A computer can be of two types,Desktop and Laptop,each having ...
user28560's user avatar
0 votes
1 answer
347 views

Partitioning table with billion row

I have a big table referenced by other tables and need to split the table on several parts. I create table by CREATE TABLE product_part0 () INHERITS (product); Move some rows to product_part0 by ...
Vladislav's user avatar
  • 121
7 votes
2 answers
16k views

How to drop inheritance?

I am new to PostgreSQL. The situation I have is someone created a child table inherits from the parent table. And dropped the child table. But the parent table still has the "down arrow" sign on it. ...
user2486675's user avatar

1
2