From: marcelo <marcelo.nicolet@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Enforce primary key on every table during dev?
Date: Thu, 1 Mar 2018 17:48:34 -0300
Message-ID: <6057ff27-b072-2827-1ca5-943ca423026f@gmail.com> (raw)
In-Reply-To: <CAKFQuwYfMWsVC=fOMw1ytY0F1XJ+HYNsoHkPgQmnpBXAyfSZHQ@mail.gmail.com>
References: <C9EFC294-83B5-41FD-9542-60FDBB2588C6@gmail.com>
<161e1761560-58a6-18e4b@webjas-vad211.srv.aolmail.net>
<5a1870db-7018-fe15-ac60-ffe37abb7077@cox.net>
<5da96fe6-666b-1107-ee76-b464417bd1b7@cox.net>
<80d9a83d-fbf4-e4fa-9ccf-9272a074c50d@cox.net>
<CAKFQuwYfMWsVC=fOMw1ytY0F1XJ+HYNsoHkPgQmnpBXAyfSZHQ@mail.gmail.com>
On 01/03/2018 17:32 , David G. Johnston wrote:
> On Thu, Mar 1, 2018 at 1:24 PM, Ron Johnson <ron.l.johnson@cox.net
> <mailto:ron.l.johnson@cox.net>>wrote:
>
> Why have the overhead of a second unique index? If it's "ease of
> joins", then I agree with Francisco Olarte and use the business
> logic keys in your joins even though it's a bit of extra work.
>
>
> The strongest case, for me, when a surrogate key is highly desirable
> is when there is no truly natural key and the best key for the model
> is potentially alterable. Specific, the "name" of something. If I add
> myself to a database and make name unique, so David Johnston, then
> someone else comes along with the same name and now I want to add the
> new person as, say David A. Johnston AND rename my existing record to
> David G. Johnston. I keep the needed uniqueness and don't need to
> cobble together other data elements. Or, if I were to use email
> address as the key the same physical entity can now change their
> address without me having to cascade update all FK instances too.
> Avoiding the FK cascade when enforcing a non-ideal PK is a major good
> reason to assign a surrogate.
>
> David J.
>
I suffered myself what David said as an example...
---
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: marcelo.nicolet@gmail.com
Subject: Re: Enforce primary key on every table during dev?
In-Reply-To: <6057ff27-b072-2827-1ca5-943ca423026f@gmail.com>
References: <C9EFC294-83B5-41FD-9542-60FDBB2588C6@gmail.com> <161e1761560-58a6-18e4b@webjas-vad211.srv.aolmail.net> <5a1870db-7018-fe15-ac60-ffe37abb7077@cox.net> <5da96fe6-666b-1107-ee76-b464417bd1b7@cox.net> <80d9a83d-fbf4-e4fa-9ccf-9272a074c50d@cox.net> <CAKFQuwYfMWsVC=fOMw1ytY0F1XJ+HYNsoHkPgQmnpBXAyfSZHQ@mail.gmail.com> <6057ff27-b072-2827-1ca5-943ca423026f@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox