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:32:43 -0300
Message-ID: <933eec2b-2cb9-1d47-1142-be84ae78e720@gmail.com> (raw)
In-Reply-To: <796df4ca-62b8-c574-6b1b-742aa401250a@cox.net>
References: <C9EFC294-83B5-41FD-9542-60FDBB2588C6@gmail.com>
<161e1761560-58a6-18e4b@webjas-vad211.srv.aolmail.net>
<5a1870db-7018-fe15-ac60-ffe37abb7077@cox.net>
<GiZ41x00v1DF5NZ01iZ5Ez>
<5da96fe6-666b-1107-ee76-b464417bd1b7@cox.net>
<GjBK1x03w1DF5NZ01jBMsX>
<121bb8e7-7e33-81ff-f0d2-cad4d799595d@cox.net>
<Gk991x09V1DF5NZ01k9BG0>
<796df4ca-62b8-c574-6b1b-742aa401250a@cox.net>
On 01/03/2018 17:21 , Ron Johnson wrote:
> On 03/01/2018 02:08 PM, marcelo wrote:
>>
>>
>> On 01/03/2018 16:42 , Ron Johnson wrote:
>>> On 03/01/2018 01:11 PM, marcelo wrote:
>>>>
>>>> On 01/03/2018 16:00 , Ron Johnson wrote:
>>> [snip]
>>>>> If your only unique index is a synthetic key, then you can insert
>>>>> the same "business data" multiple times with different synthetic
>>>>> keys.
>>>>>
>>>>>
>>>>> --
>>>>> Angular momentum makes the world go 'round.
>>>> IMHO, business logic can and must preclude "garbage insertion".
>>>> Except you are inserting data directly to database using SQL, any
>>>> n-tier architecture will be checking data validity.
>>> bl
>>> Any n-tier architecture that's bug-free.
>>>
>> Do you know about unit testing?
>
> Way Back When Dinosaurs Still Roamed The Earth and I first learned the
> trade, the focus was on proper design instead of throwing crud against
> the wall and hoping tests caught any bugs. Because, of course, unit
> tests are only as good as you imagination in devising tests.
>
>
So, you are fully convinced that there´s no bug free software... Same as
I (and you) can code following the business rules, you (and me) can
design unit tests not from "imagination" but from same rules.
Moreover: you can have a surrogate key (to speedup foreign keys) and
simultaneously put a unique constraint on the columns requiring it.
What´s the question?
---
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: <933eec2b-2cb9-1d47-1142-be84ae78e720@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> <GiZ41x00v1DF5NZ01iZ5Ez> <5da96fe6-666b-1107-ee76-b464417bd1b7@cox.net> <GjBK1x03w1DF5NZ01jBMsX> <121bb8e7-7e33-81ff-f0d2-cad4d799595d@cox.net> <Gk991x09V1DF5NZ01k9BG0> <796df4ca-62b8-c574-6b1b-742aa401250a@cox.net> <933eec2b-2cb9-1d47-1142-be84ae78e720@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