I have multiple table chaining like so:
Table1
product_id SERIAL NOT NULL,
name varchar,
Table2 ( kept separate from table1 because same product name but can be different color )
table2_id
product_id integer,
color varchar,
FOREIGN KEY (product_id) REFERENCES table1 (product_id) ON DELETE CASCADE
table3 ( kept separate from table2 because same product color but can be different size)
table3_id
table2_id integer,
size varchar,
FOREIGN KEY (table2_id) REFERENCES table2 (table2_id) ON DELETE CASCADE
e.g product data could exist in such a manner:
a chair (name) - red (color) - 100cm(size)
a chair (name) - red (color) - 200cm(size)
b chair (name) - green (color) - 100cm(size)
b chair (name) - green (color) - 200cm(size)
c chair (name) - black (color) - s(size)
c chair (name) - black (color) - m(size)
d chair (name) - black (color) - null(size)
e chair (name) - gold (color) - big(size)
e chair (name) - gold (color) - small(size)
To normalize the tables (ie,to remove the duplicates), I separated them as 3 tables but I'm not sure whether chaining like this correct or not.