Re: Enforce primary key on every table during dev?
От | marcelo |
---|---|
Тема | Re: Enforce primary key on every table during dev? |
Дата | |
Msg-id | 933eec2b-2cb9-1d47-1142-be84ae78e720@gmail.com обсуждение исходный текст |
Ответ на | Re: Enforce primary key on every table during dev? (Ron Johnson <ron.l.johnson@cox.net>) |
Ответы |
Re: Enforce primary key on every table during dev?
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: