Let’s say I have a table such as:
CREATE TABLE t1 (
col1 int,
col2 int
);
and a “metadata table” classifying these attributes:
CREATE TABLE t2 (
attribute varchar,
description varchar
);
So sample data might be:
t1:
col1 | col2
------+------
4 | 6
t2:
attribute | description
------------+--------------
col1 | first column
col2 | second column
What are the pros and cons of using this approach? It certainly makes me uncomfortable but I can’t put into words any solid objections.
Edit: it makes me uncomfortable because this design tends towards an Entity-Attribute-Value data model where everything may as well be stored in one table, i.e. the data model no longer captures as much meaning. I’m trying to quantify how much of a problem this really is.
It sounds like what you are describing is Entity Attribute Value (EAV) or possibly row modeling. Search on these terms. You will find that there are a few advantages and many, many disadvantages.
Storing metadata in your data model’s repository is good. Modeling a metadata repository in your schema is almost certainly unnecessary and unhelpful.