From: | Ron Johnson <ronljohnsonjr(at)gmail(dot)com> |
---|---|
To: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Lookup tables |
Date: | 2025-02-04 15:12:33 |
Message-ID: | CANzqJaCEUN0UnpjW29guR1psfw3JhNmR_AeHEMMmoxCzKJXE_g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgadmin-support pgsql-general |
On Tue, Feb 4, 2025 at 10:05 AM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:
> On Tue, 4 Feb 2025, Ron Johnson wrote:
>
> > Does your lookup table just have one column? (That's what your question
> > seems to imply, but that makes no sense, since the whole point of a
> lookup
> > table is to store some sort of a code in the "child" table instead of the
> > whole text of the description.)
>
> Ron,
>
> Yes, each has a single column of type names, industrytypes and statustypes.
> I've always used the descriptive names in queries.
>
Yeah, that's definitely Bad Design, for the reason David enumerated.
In the lookup table, the PK can be either synthetic (an integer that means
nothing) or natural (a short text code, typically four characters) that is
an abbreviation of the description.
Synthetic keys have been the norm for the past 25+ years, but I have a soft
spot for natural keys.
Natural keys become unwieldy, though, when more than two columns are
required to define primality.
--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-02-04 15:18:35 | Re: Lookup tables |
Previous Message | Tony Shelver | 2025-02-04 15:11:00 | Re: Lookup tables |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2025-02-04 15:18:35 | Re: Lookup tables |
Previous Message | Tony Shelver | 2025-02-04 15:11:00 | Re: Lookup tables |