Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erUsn-0008EX-0p for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 20:32:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erUsl-0004cR-KA for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 20:32:51 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erUsl-0004cB-94 for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 20:32:51 +0000 Received: from mail-qk0-x229.google.com ([2607:f8b0:400d:c09::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1erUsi-0002ue-Ix for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 20:32:50 +0000 Received: by mail-qk0-x229.google.com with SMTP id z197so9291027qkb.6 for ; Thu, 01 Mar 2018 12:32:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=AehbNq6hcTGVY/U4wCG3gKnP0LZQdA5Qkmsqn5Gnp2w=; b=sbUgpRrQ7VG650vsC5iuYd+spDL0HL6Sgzb0jhdiSmndJrizJ7MN3wJfNyQIdZLe4U tGjWIvcrfp4RCLG67sx93lqKhtuO+Ip5ew+L33KjTdZ//YximUJEytAD9g5TrV/C00WD U3qiF5Sqmkz0wRaxA2k3Q1fPPH2Wqs9eJO91FobdWNgqzXdU1mb3ES9EHE0Q8Hne5YjJ eYCUj08jvu6lTcxOjMSDn01fskTTYTdGFxm1JCVuxvVReyfF6CqzjX5H6dw+qQVw27t3 9+8MBUX1mfG+bGSlBZB+vFDupx2cVtrRumfOa5if879LJHhn2wHKrsOv34Oy3A9puXk0 GLbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=AehbNq6hcTGVY/U4wCG3gKnP0LZQdA5Qkmsqn5Gnp2w=; b=QeP8eZmweMmO9QyUgS28QL0Dgo63ek5z2YGZ0xWPc3Xk1x7FLF1adYLyhOEACVtehm +tdFhE67gK1s/R7cSl+1/9vIzptszkXeKUkfpUc9xMDPbs7Z95LsZtqhSehMLabAJOo9 WJ5HNNf2ZvUULQ8q+3jCO6vmRlqydfytdN561kvCjBo8a0JpHMWK3kGTxcmDqzSxGsEf jnl/jVToVwMGQ+I7gJtMB50nYttST/GQFyWiXgqIgUTGWCih7NzV5zWWulXq6EXdGfxo p0yvXCgMm+ypPTDeOOW9ol2jtPkmMhhD/9YmfyyM5Vl9ZobNM1JsSEp5skf6CaeUCxa2 bG2w== X-Gm-Message-State: AElRT7EAzQtSz3FKcTp7gZttlAlAyhBDGySY2I/rxKGsXMYOX+E8B4bu SIpdobA6BAY+vr5gZJ1djFSIKfbC X-Google-Smtp-Source: AG47ELuyts0em/zTwTj6tXOB6dbo130jNhLbQPfR0/i5cOQRuxqT+d4I6piGbKE+B+30N4PKPffm0w== X-Received: by 10.55.191.1 with SMTP id p1mr4775274qkf.97.1519936366964; Thu, 01 Mar 2018 12:32:46 -0800 (PST) Received: from [192.168.1.250] (host63.190-229-77.telecom.net.ar. [190.229.77.63]) by smtp.gmail.com with ESMTPSA id y20sm3239276qka.71.2018.03.01.12.32.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 12:32:46 -0800 (PST) Subject: Re: Enforce primary key on every table during dev? To: pgsql-general@lists.postgresql.org References: <161e1761560-58a6-18e4b@webjas-vad211.srv.aolmail.net> <5a1870db-7018-fe15-ac60-ffe37abb7077@cox.net> <5da96fe6-666b-1107-ee76-b464417bd1b7@cox.net> <121bb8e7-7e33-81ff-f0d2-cad4d799595d@cox.net> <796df4ca-62b8-c574-6b1b-742aa401250a@cox.net> From: marcelo Message-ID: <933eec2b-2cb9-1d47-1142-be84ae78e720@gmail.com> Date: Thu, 1 Mar 2018 17:32:43 -0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <796df4ca-62b8-c574-6b1b-742aa401250a@cox.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Antivirus: Avast (VPS 180228-6, 28/02/2018), Outbound message X-Antivirus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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