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 1erUhh-0007AP-0j for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 20:21:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erUhf-0001sK-IW for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 20:21:23 +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 1erUhf-0001sB-7O for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 20:21:23 +0000 Received: from eastrmfepo101.cox.net ([68.230.241.213]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erUhc-0002cY-6C for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 20:21:22 +0000 Received: from eastrmimpo305.cox.net ([68.230.241.237]) by eastrmfepo101.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20180301202118.IVVG11711.eastrmfepo101.cox.net@eastrmimpo305.cox.net> for ; Thu, 1 Mar 2018 15:21:18 -0500 Received: from [192.168.1.10] ([70.171.109.83]) by eastrmimpo305.cox.net with cox id GkMJ1x00K1o04Vy01kMJy1; Thu, 01 Mar 2018 15:21:18 -0500 X-Authority-Analysis: v=2.2 cv=ZJOnoTzb c=1 sm=1 tr=0 a=uCHdjGDeLqaieW9t8IbZ6A==:117 a=uCHdjGDeLqaieW9t8IbZ6A==:17 a=IkcTkHD0fZMA:10 a=x7bEGLp0ZPQA:10 a=-JybvOsIqBJ4OvFc7YYA:9 a=QEXdDO2ut3YA:10 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=ron.l.johnson@cox.net 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> From: Ron Johnson Message-ID: <796df4ca-62b8-c574-6b1b-742aa401250a@cox.net> Date: Thu, 1 Mar 2018 14:21:18 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. >> >> 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. -- Angular momentum makes the world go 'round.