Re: Almost relational PostgreSQL (was: one-to-one)

From: Antonios Christofides <anthony(at)itia(dot)ntua(dot)gr>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Almost relational PostgreSQL (was: one-to-one)
Date: 2003-11-04 18:52:23
Message-ID: 20031104185223.GB5115@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Josh Berkus wrote:
> My personal limit of denormalization stops at a few NULL columns and using
> cache tables to hold copies of views which are too slow.

Here's a trivial design problem involving NULLs (the only conscious
violation of Pascal I did in that database): I have a "gaddresses" table
that holds addresses of geographical points (such as your house):

id (PK and FK: specifies the geographical point of which we are giving the address)
country (FK)
state (FK, nullable: specifies the state of the US if the country is US)
address (the rest of the address)

Pascal says: use NULL only for missing, not for inapplicable. Here the
state is inapplicable unless the country is US.

What should I do instead? Create another table, "gstates"?

id (PK and FK to gaddresses)
state (FK)

Is this overkill?

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2003-11-04 21:46:25 Re: Almost relational PostgreSQL (was: one-to-one)
Previous Message Antonios Christofides 2003-11-04 18:51:25 Surrogate vs natural keys (Was: Almost relational PostgreSQL (was: one-to-one))