Re: Feature Proposal: Constant Values in Columns or Foreign Keys - Mailing list pgsql-general

From Nils Gösche
Subject Re: Feature Proposal: Constant Values in Columns or Foreign Keys
Date
Msg-id 002801cd1d92$5072e470$f158ad50$@de
Whole thread Raw
In response to Re: Feature Proposal: Constant Values in Columns or Foreign Keys  (Bartosz Dmytrak <bdmytrak@gmail.com>)
List pgsql-general
Bartosz Dmytrak wrote:

> according to DB theory:
> 1NF: Table faithfully represents a relation and has no repeating groups
> 2NF: No non-prime attribute in the table is functionally dependent on a proper subset of anycandidate key.
> source: http://en.wikipedia.org/wiki/Database_normalization#Normal_forms

> so these constants are not in line with this approach.

This is true.  That's why you would have to guard the "constantness" of the column/attribute with a CHECK constraint,
toavoid update anomalies. 

Yes, the whole model would be simpler and more beautiful without the type column, and trigger functions on the derived
tablesinstead. On the other hand, the foreign key including the type field might be faster than the foreign key without
thetype field plus trigger function. So, if this approach is any good, then only if it is actually faster. No, I
haven'ttimed it :-) 

Regards,
--
Nils Gösche
Don't ask for whom the <Ctrl-G> tolls.


Attachment

pgsql-general by date:

Previous
From: Efraín Déctor
Date:
Subject: pgstat wait timeout
Next
From: "Welty, Richard"
Date:
Subject: somewhat high profile project using PostgreSQL