Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nu086-0004q6-1A for pgsql-general@arkaria.postgresql.org; Wed, 25 May 2022 23:09:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nu083-000461-2h for pgsql-general@arkaria.postgresql.org; Wed, 25 May 2022 23:09:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nu082-00045l-OC for pgsql-general@lists.postgresql.org; Wed, 25 May 2022 23:09:22 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nu080-0000Hv-Gi for pgsql-general@lists.postgresql.org; Wed, 25 May 2022 23:09:22 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 89AC82A0107 for ; Wed, 25 May 2022 16:09:17 -0700 (PDT) Date: Wed, 25 May 2022 16:09:17 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Automatic PK values not added to new rows In-Reply-To: <6d67d16b-7cdd-2f40-9ebe-82a499eb11c2@gmx.net> Message-ID: <452c4b59-d43a-f413-114-e35bd5f9d3d2@appl-ecosys.com> References: <6d67d16b-7cdd-2f40-9ebe-82a499eb11c2@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 25 May 2022, Thomas Kellerer wrote: > If you want to prevent such a situation in the future, you might want to > consider defining those columns as "generated always as identity" instead > of "serial". > > Then you'd get an error if you try to bypass the database generated values. Thanks, Thomas. Rich