Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxETx-00038V-Gs for pgsql-general@arkaria.postgresql.org; Mon, 12 Aug 2019 17:51:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hxETw-0008Cf-D3 for pgsql-general@arkaria.postgresql.org; Mon, 12 Aug 2019 17:51:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hxETw-0008CK-0W for pgsql-general@lists.postgresql.org; Mon, 12 Aug 2019 17:51:44 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1hxETm-0004Rj-Vd for pgsql-general@lists.postgresql.org; Mon, 12 Aug 2019 17:51:40 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 466k1K3Bt4z1Zr5 for ; Mon, 12 Aug 2019 13:51:33 -0400 (EDT) Received: by panix2.panix.com (Postfix, from userid 17622) id 466k1K1cgSz1ZVM; Mon, 12 Aug 2019 13:51:33 -0400 (EDT) Date: Mon, 12 Aug 2019 13:51:33 -0400 From: stan To: pgsql-general@lists.postgresql.org Subject: "Locking rows" Message-ID: <20190812175133.GC681@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have a customer requirement/desire. The system is (among other things) essentially a employee time sheet. The manager wants for an employee to not be able to modify a given row in the table they enter time into once it is committed. I personally see issues with this, but I am willing to try to give him what he wants. If it creates issues we can sort them out, once he sees the issues. The only way I see to do this is to add a column (call it lock). I will then set this up as a default entry with a value of TRUE. The form the employee uses to enter this will, of course, not display this column. The I will create a function that on UPDATE, checks for the presence of the 1 in this row, and rejects the update. Then I will give the manager a form where he can set this flag to FALSE. Looks ugly, and convulsed to me. Is here a more "database native" way to handle this? -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin